From Fedora Project Wiki

< CI

Revision as of 11:40, 27 February 2018 by Psss (talk | contribs) (Document BeakerLib and RHTS roles)

Description

Package standard-test-roles provides shared Ansible roles and inventory scripts implementing the Standard Test Interface. It has support for multiple testing frameworks (such as BeakerLib or Avocado) and in this way allows to easily enable existing tests in Fedora CI.

Links

Pagure and Copr repositories:

Install

Install the latest version from the copr repo:

dnf/yum copr -y enable @osci/standard-test-roles
dnf/yum update standard-test-roles

Roles

Here's the list of currently supported roles:

  • avocado
  • basic
  • beakerlib
  • repo
  • rhts
  • rpm
  • scripts
  • source

BeakerLib

If you have a set of beakerlib tests, it is recommended to place each test in its own subdirectory.

Then, create tests.yml file with contents similar to the following which runs tests using the 'standard-test-beakerlib' role included in the standard-test-roles package. The list provided for the 'tests' parameter should be the list of names of your per-test subdirectories, and the 'required_packages' parameter should contain a list of additional packages that need to be installed to run the tests.

---
- hosts: localhost
  tags:
  - atomic
  - classic
  - container
  roles:
  - role: standard-test-beakerlib
    tests:
    - cmd-line-options
    required_packages:
    - which         # which package required for cmd-line-options
    - rpm-build     # upstream-testsuite requires rpmbuild command
    - libtool       # upstream-testsuite requires libtool
    - gettext       # upstream-testsuite requires gettext

Note: The 'required_packages' parameter is ignored when running on Atomic Host--since there is no way to install additional packages in that environment.

RHTS

If you have a set of tests you want to run using restraint, each test must be placed in its own subdirectory.

Then, create tests.yml file with contents similar to the following which runs tests using the 'standard-test-rhts' role included in the standard-test-roles package. The list provided for the 'tests' parameter should be the list of names of your per-test subdirectories, and the 'required_packages' parameter should contain a list of additional packages that need to be installed to run the tests.

---
- hosts: localhost
  tags:
  - classic
  - docker
  roles:
  - role: standard-test-rhts
    tests:
    - cmd-line-options
    required_packages:
    - which         # which package required for cmd-line-options
    - rpm-build     # upstream-testsuite requires rpmbuild command
    - libtool       # upstream-testsuite requires libtool
    - gettext       # upstream-testsuite requires gettext

Note: Tests using the 'standard-test-rhts' role are not compatible with Atomic Host--since it requires the installation of additional packages and there is no way to do so in that environment. We reflect that by omitting atomic from the <tags> section.

Contact

  • Andrei Stepanov (astepano)