diff --git a/roles/validate-tempest/README.md b/roles/validate-tempest/README.md index ff04f9e39..e936642c2 100644 --- a/roles/validate-tempest/README.md +++ b/roles/validate-tempest/README.md @@ -20,9 +20,11 @@ Role Variables * `test_regex` - tests regular expression for testr run, i.e. smoke or tempest.api.object_storage|keystone_tempest_plugin. * `run_tempest`: false/true - to run tempest or not * `tempest_config`: false/true - whether to prepare the script which configures and runs tempest or not +* `tempest_whitelist`: list - list of tests you want to be executed. set `skip_file_src` + to empty if you don't want to run with blacklist_file option. + Default value is an empty list * `skip_file_src`: path to skip tests file, set it empty if running without skip list: `skip_file_src=''` * `tempest_workers`: int - how many parallel workers to run (default is number of cores) -* `tempest_tests_file`: path to file - path to file with tests to run * `tempest_until_failure`: false/true - default is false, repeat the run again and again until failure occurs * `tempest_exit_on_failure`: true/false - whether to exit from role with tempest exit code (default: true) * `tempestmail_config`: config.yaml - name of config file for tempestmail script diff --git a/roles/validate-tempest/defaults/main.yml b/roles/validate-tempest/defaults/main.yml index 26b26c059..10fa03c31 100644 --- a/roles/validate-tempest/defaults/main.yml +++ b/roles/validate-tempest/defaults/main.yml @@ -23,6 +23,9 @@ tempest_overcloud: true run_tempest: false post_tempest: true tempest_format: packages # venv or packages +tempest_whitelist_file_src: "whitelist_file.j2" +tempest_whitelist_file: "whitelist_file" +tempest_whitelist: [] skip_file_src: "skip_file.j2" skip_file: skip_file tempest_until_failure: false diff --git a/roles/validate-tempest/tasks/pre-tempest.yml b/roles/validate-tempest/tasks/pre-tempest.yml index ebdec50df..0c2e594f2 100644 --- a/roles/validate-tempest/tasks/pre-tempest.yml +++ b/roles/validate-tempest/tasks/pre-tempest.yml @@ -15,6 +15,7 @@ - name: Load skip list variables include_vars: file: "tempest_skip_{{ release }}.yml" + when: skip_file_src != '' - name: Create tempest skipfile template: @@ -23,6 +24,13 @@ mode: 0644 when: skip_file_src != '' +- name: Create tempest white file + template: + src: "{{ tempest_whitelist_file_src }}" + dest: "{{ working_dir }}/{{ tempest_whitelist_file }}" + mode: 0644 + when: tempest_whitelist|length > 0 + - ignore_errors: true block: - name: Copying bugcheck files diff --git a/roles/validate-tempest/templates/run-tempest.sh.j2 b/roles/validate-tempest/templates/run-tempest.sh.j2 index 9e8ddd191..ef7b9cbf9 100644 --- a/roles/validate-tempest/templates/run-tempest.sh.j2 +++ b/roles/validate-tempest/templates/run-tempest.sh.j2 @@ -9,14 +9,14 @@ ## running tests: https://bugs.launchpad.net/tempest/+bug/1669455 {% if tempest_format == "venv" %} -export OSTESTR='{{ working_dir }}/tempest_git/tools/with_venv.sh ostestr --regex' +export OSTESTR='{{ working_dir }}/tempest_git/tools/with_venv.sh ostestr' export S2JXML='{{ working_dir }}/tempest_git/tools/with_venv.sh subunit2junitxml --output-to=tempest.xml' export SUBUNIT='{{ working_dir }}/tempest_git/tools/with_venv.sh subunit-trace --no-failure-debug -f' export TEMPESTCLI='{{ working_dir }}/tempest_git/tools/with_venv.sh tempest' ## List Tests {{ working_dir }}/tempest_git/tools/with_venv.sh ostestr -l {% elif tempest_format == "packages" %} -export OSTESTR='ostestr --regex' +export OSTESTR='ostestr' export S2JXML='subunit2junitxml --output-to=tempest.xml' export SUBUNIT='subunit-trace --no-failure-debug -f' export TEMPESTCLI='/usr/bin/tempest' @@ -32,9 +32,11 @@ $TEMPESTCLI list-plugins $TEMPESTCLI cleanup --init-saved-state {% endif %} -( $OSTESTR '({{ test_regex }})' --no-pretty --subunit {% if skip_file_src != '' %}--blacklist_file={{ working_dir }}/{{ skip_file }}{% endif %} +( $OSTESTR --no-pretty --subunit \ +{% if test_regex != '' %} --regex '({{ test_regex }})' {% endif %} +{% if tempest_whitelist|length > 0 %} --whitelist_file={{ working_dir }}/{{ tempest_whitelist_file }} {% endif %} +{% if skip_file_src != '' %} --blacklist_file={{ working_dir }}/{{ skip_file }} {% endif %} {% if tempest_workers is defined %} --concurrency {{ tempest_workers }} {% endif %} -{% if tempest_tests_file is defined %} --load-list={{ tempest_tests_file }} {% endif %} {% if tempest_until_failure|bool %} --until-failure {% endif %} ) | tee >( $S2JXML ) | $SUBUNIT diff --git a/roles/validate-tempest/templates/whitelist_file.j2 b/roles/validate-tempest/templates/whitelist_file.j2 new file mode 100644 index 000000000..82738884e --- /dev/null +++ b/roles/validate-tempest/templates/whitelist_file.j2 @@ -0,0 +1,3 @@ +{% for test in tempest_whitelist %} +{{ test }} +{% endfor %}