Examples

On this page you can find some inspiration from real-life examples of tests already enabled in the Fedora CI.

Python

There are multiple versions of Python programming language available in Fedora and a number of related subpackages. As all of them should be tested (including their various combinatios) we share test coverage for them in the tests namespace:

The test repo contains basic smoke test for virtualenv together with example test Metadata stored in the Flexible Metadata Format:

Once the test is avaible in the share test repository it can be easily linked from supported Python versions:

We test additional Python implementations as well:

Plus we ensure that essential tools for venv and virtualenv, such as setuptools, pip or virtualenv itself correctly work with all supported versions:

Note that for the last set of examples we run the same test several times with modified environment. For example:

  - name: tests_python
    how: shell
    url: https://src.fedoraproject.org/tests/python.git
    tests:
    - name: smoke36
      path: /smoke
      test:  VERSION=3.6 INSTALL_OR_SKIP=true ./venv.sh
    - name: smoke39
      path: /smoke
      test:  VERSION=3.9 INSTALL_OR_SKIP=true ./venv.sh
    - name: smoke310
      path: /smoke
      test:  VERSION=3.10 INSTALL_OR_SKIP=true ./venv.sh

In this way we create several virtual test cases from a single test code which prevents duplication and minimizes future maintenance.

SELinux

There are several components related to SELinux. They are tightly connected so change in one of them can cause problems in other. That’s why their tests are shared and executed together:

Instead of listing relevant tests to be executed manually in each dist-git package repository Flexible Metadata Format is used, e.g. in libsepol:

summary: selinux tests - Tier 1 | libsepol
discover:
    how: fmf
    url: https://src.fedoraproject.org/tests/selinux
    filter: "tier: 1 | component: libsepol"
execute:
    how: tmt

The filter selects all tests relevant for the libsepol component plus all Tier 1 selinux tests.

The following six components are covered:

Use the fmf command line tool to quickly check which tests will be scheduled:

# dnf install -y fmf
# fedpkg clone -a tests/selinux
# cd selinux
# fmf ls --filter "tier: 1 | component: libsepol"
/checkpolicy/checkmodule
/checkpolicy/checkpolicy
/checkpolicy/checkpolicy-docs
/kernel/selinux-testsuite
/libselinux/matchpathcon-in-chroot-env
/libselinux/realpath_not_final-function
/libselinux/selabel-functions
/libselinux/selabel_lookup-and-local-changes
/libselinux/selinux_boolean_sub-function
/libselinux/selinux_restorecon-functions
/libselinux/selinux_sestatus-functions
/libselinux/selinux_set_callback
/libselinux/setenforce
/libselinux/validatetrans
...

See the Flexible Metadata Format documentation for other options how to install fmf.