Enable tempest to run with whitelist

Due to scenario jobs starting to execute a set of tempest tests, it's
good to have an option to add these tests in a white list instead
of care about the complexity that a long regex line can bring.

Change-Id: Id1ba7af48173460ef41d9b4df3db723811dc67da
This commit is contained in:
Arx Cruz 2017-07-19 17:39:46 +02:00
parent a6d70d9112
commit 150cd76f47
5 changed files with 23 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,3 @@
{% for test in tempest_whitelist %}
{{ test }}
{% endfor %}