From Fedora Project Wiki

< Changes

Revision as of 17:50, 13 April 2017 by Flepied (talk | contribs) (Created page with "= Standard Discovery, Packaging, Invocation of Integration Tests via a distgit control file = {{admon/warning|This is a proposal|Feedback is more than welcome. There's a ''di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Standard Discovery, Packaging, Invocation of Integration Tests via a distgit control file

This is a proposal
Feedback is more than welcome. There's a discussion tab above.

First see the Terminogy division of Responsibilities and Requirements


Detailed Description

This standard interface describes how to discover, stage and invoke tests. It is important to cleanly separate implementation details of the testing system from the test suite and its framework. It is also important to allow packagers to locally and manually invoke a test suite.


The description of the tests are stored in the dist-git repos in the tests/control file. The control file follows the syntax described in the DEP 8 specification.

Here is an example of a control file to describe 2 tests for systemd:

Tests: timedated, hostnamed
Depends: systemd,
Restrictions: needs-root, isolation-container

In the example, it references 2 tests (timedated and hostnamed) with the needed packages to install and the features needed on the system under test (root access and container isolation in the example).

The tests themselves are described in the files named from the Tests field (timedated and hostnamed in the example) and they need to be executable. They can be programmed in any language (shell, python, ansible...).

Functional tests that are included in the source tree of the package could be packaged and driven through the test scripts.

Some tests could be reused from the Debian/Ubuntu packages allowing more collaboration with these Linux distributions. They have more than 6000 packages with tests.


The system under test needs to be selected according the Restrictions field. This will allow to run tests on light setups to full systems: from chroot, schroot, container, ssh accessible system (vm or bare metal)...


We have 2 options: port the autopkgtest tool to support rpm/dnf (a partial port is already available) or write a program that reads the tests/control file, copy the needed the files into the system under test and run the corresponding test scripts.


Here is an extract of the timedated test from the systemd example:

set -e

. `dirname $0`/

ORIG_TZ=$(timedatectl | grep -F 'Time zone'|sed -e 's@.*: @@' -e 's@ .*@@')
echo "original tz: $ORIG_TZ"

echo 'timedatectl works'
assert_in "Local time:" "`timedatectl --no-pager`"

echo 'change timezone'
assert_eq "`timedatectl --no-pager set-timezone Europe/Moscow 2>&1`" ""
assert_eq "`readlink /etc/localtime | sed 's#^.*zoneinfo/##'`" "Europe/Moscow"
[ -n "$TEST_UPSTREAM" ] || assert_in "Europe/Moscow" "`timedatectl | grep -F 'Time zone: '`"
assert_in "Time.*zone: Europe/Moscow (MSK, +" "`timedatectl --no-pager`"

echo 'reset timezone to original'
assert_eq "`timedatectl  --no-pager set-timezone $ORIG_TZ 2>&1`" ""
assert_eq "`readlink /etc/localtime | sed 's#^.*zoneinfo/##'`" "$ORIG_TZ"
[ -n "$TEST_UPSTREAM" ] || assert_eq "`timedatectl | grep -F 'Time zone'|sed -e 's@.*: @@' -e 's@ .*@@'`" "$ORIG_TZ"

Upgrade/compatibility impact

There are no real upgrade or compatibility impact. The tests will be branched per release as the dist-git repos are branched.