From Fedora Project Wiki

< CI‎ | Metadata

(Initial version)
 
(The page has been obsoleted.)
Line 1: Line 1:
 
Content has been obsoleted by https://fedoraproject.org/wiki/CI/Examples.
= SELinux =
 
Here's an example of how [[Flexible_Metadata_Format|Flexible Metadata Format]] can simplify test execution when number of tests grows. We would like to execute all available tests relevant to the <code>libselinux</code> component plus all <code>Tier1</code> selinux tests.
 
== List ==
 
The old way is the provide a full list of tests to be executed:
 
- hosts: localhost
  roles:
  - role: standard-test-beakerlib
    tags:
    - classic
    repositories:
    - repo: "https://src.fedoraproject.org/tests/selinux.git"
      dest: "selinux"
    tests:
    - selinux/policycoreutils/restorecon
    - selinux/libselinux/realpath_not_final-function
    - selinux/libselinux/selinux_boolean_sub-function
    - selinux/libselinux/selinux_restorecon-functions
    - selinux/libselinux/setenforce
    - selinux/libselinux/getsebool
    - selinux/libselinux/selabel-functions
    - selinux/libselinux/selinux_restorecon
    - selinux/libselinux/selinux_sestatus-functions
    - selinux/libselinux/selinux_set_callback
    - selinux/checkpolicy/checkpolicy
    - selinux/libsepol/sepol_check_context
    - selinux/libsemanage/semanage-seuser-functions
 
This list would have to be kept up-to-date after each test addition.
 
== Command ==
 
Another slightly better option would be to provide an easy way how to generate the list of tests to be executed, for example directly with the <code>fmf</code> command line tool:
 
- hosts: localhost
  roles:
  - role: standard-test-beakerlib
    tags:
    - classic
    repositories:
    - repo: "https://src.fedoraproject.org/tests/selinux.git"
      dest: "selinux"
    tests_command: "fmf selinux --brief --key test --filter 'component:libselinux | tags:Tier1'"
 
Test name does not always have to map to the directory where the test is stored so the following command would have to be used to make it more general:
 
fmf --key test --format "{}/{}\n" --value "root" --value "data.get(''path'') or name" --filter 'component:libselinux | tags:Tier1'
 
Which seems to be a bit complicated.
 
== Integration ==
 
The best solution probably will be to integrate Flexible Metadata Format directly in the Standard Test Roles. The <code>tests.yaml</code> file could then be much more readable:
 
- hosts: localhost
  roles:
  - role: standard-test-beakerlib
    tags:
    - classic
    repositories:
    - repo: "https://src.fedoraproject.org/tests/selinux.git"
      dest: "selinux"
    test_directories:
        - "selinux"
    test_filters:
        - "component:libselinux | tags:Tier1"
 
Standard Test Roles would then internally call <code>fmf</code> to filter relevant tests and directly executed them. Plus it would be possible to integrate [[CI/Test_Case_Relevancy|Test Case Relevancy]] to offer filtering based on the particular environment.

Revision as of 13:26, 18 October 2018

Content has been obsoleted by https://fedoraproject.org/wiki/CI/Examples.