From 117b095d25fd565c0c55f5b411e77d6c98e3bd04 Mon Sep 17 00:00:00 2001 From: Petr Šplíchal Date: Aug 16 2018 13:58:49 +0000 Subject: Incorporate pull request feedback * Rename parameter to "fmf_filter" to make it more distinct * Extend comment for the str-filter-tests command * Gather results from filtered tests as well * Add forgotten link to fmf documentation --- diff --git a/roles/standard-test-beakerlib/README.md b/roles/standard-test-beakerlib/README.md index ae1574e..09897f5 100644 --- a/roles/standard-test-beakerlib/README.md +++ b/roles/standard-test-beakerlib/README.md @@ -6,7 +6,7 @@ testing. You can redefine the following variables in `roles/standard-test-beakerlib/vars/main.yml`: * **tests**: A list of beakerlib test files - * **filter**: An fmf filter to select tests based on test metadata [1] + * **fmf_filter**: An fmf filter to select tests based on test metadata [1] * **artifacts**: An artifacts directory on localhost to store logs * **remote_artifacts**: The directory on the system under test where the logs are stored. Note: if this variable is left undefined, it will default to @@ -22,7 +22,7 @@ testing. You can redefine the following variables in url ... repository url (required) dest ... destination directory (required) version ... desired branch (optional, defaults to master) - filter ... fmf filter (optional, used for test selection) + fmf_filter ... fmf filter (optional, used for test selection) Example usage: @@ -53,7 +53,7 @@ possible to provide an fmf [1] filter in the following way: repositories: - repo: "https://src.fedoraproject.org/tests/shell.git" dest: "shell" - filter: "tier: 1" + fmf_filter: "tier: 1" Filter can be used also if tests are stored directly in the git: @@ -62,7 +62,7 @@ Filter can be used also if tests are stored directly in the git: - role: standard-test-beakerlib tags: - classic - filter: "tier: 1" + fmf_filter: "tier: 1" See the Fedora CI metadata wiki [1] for more details and examples on test metadata. diff --git a/roles/standard-test-beakerlib/tasks/main.yml b/roles/standard-test-beakerlib/tasks/main.yml index 14e4a4a..ef61fd2 100644 --- a/roles/standard-test-beakerlib/tasks/main.yml +++ b/roles/standard-test-beakerlib/tasks/main.yml @@ -136,6 +136,7 @@ mv ${logfile} {{ remote_artifacts }}/${status}_${log_file_name} with_items: - "{{ tests }}" + - "{{ filter_tests }}" # Can't go in block. See # https://github.com/ansible/ansible/issues/20736 diff --git a/roles/str-common-init/tasks/trunner.yml b/roles/str-common-init/tasks/trunner.yml index 4838237..d93d656 100644 --- a/roles/str-common-init/tasks/trunner.yml +++ b/roles/str-common-init/tasks/trunner.yml @@ -49,18 +49,21 @@ - set_fact: filter_command: "str-filter-tests" - set_fact: - filter_command: "{{ filter_command }} . '{{ filter }}'" - when: filter is defined + filter_command: "{{ filter_command }} . '{{ fmf_filter }}'" + when: fmf_filter is defined - set_fact: - filter_command: "{{ filter_command }} '{{ item.dest }}' '{{ item.filter }}'" + filter_command: "{{ filter_command }} '{{ item.dest }}' '{{ item.fmf_filter }}'" with_items: - "{{ repositories }}" - when: repositories is defined and item.filter is defined + when: repositories is defined and item.fmf_filter is defined - debug: var: filter_command verbosity: 1 - # Filter tests based on the gathered parameters + # Filter tests based on the gathered parameters. (The filter + # command is extended for each provided filter. That's why + # there's check for filter_command != "str-filter-tests" which + # ensures that there has been at least one filter defined.) - set_fact: filter_tests: [] - name: Filter tests according to provided fmf filters diff --git a/scripts/README.md b/scripts/README.md index 6f33e9d..fb8c642 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -35,3 +35,5 @@ This script is used to filter tests for execution based on their metadata stored in the Flexible Metadata Format [1]. It accepts pairs of the form "path filter" for each metadata tree to be investigated. Returns list of filtered tests on the stdout. + +[1] https://github.com/psss/fmf