Fix run-tempest black/exclude var setting
Before [1] we didn't have conditionals for tempest_black_regex being set or not, therefore it had a default value of empty string set in the role's defaults. However after [1] we do have such conditionals which make setting the default value unnecessary - especially when we're asking if the var is defined - it will be always defined. Therefore this patch removes the default setting of tempest_black_regex and tempest_exclude_regex. The patch also removes 'Set tempest_exclude_regex' task introduced by [1] as it appears unnecessary as well. This task simply copied tempest_black_regex value to tempest_exclude_regex. However there are 2 tasks below which do the same logic plus more - they build CLI arguments for tempest where depending on which ansible var is used the appropriate CLI arg is chosen - tempest_black_regex is set, --black-regex will be passed to tempest (for backward compatibility) and if tempest_exclude_regex is set, --exclude-regex will passed to tempest. The patch creates a new temporary ansible var which will be used only internally. The role will store in it the CLI argument chosen dynamically which is passed to tempest later. Before we reused the tempest_exclude_regex variable for that, however that causes problems whent the var is set on a role level as set_fact won't override such var. [1] https://review.opendev.org/c/openstack/tempest/+/768583 Change-Id: I3e45741057e7a95b282b03bab4695f46c62d5271
This commit is contained in:
parent
4f48261f1c
commit
8a8c85ddfc
|
@ -1,10 +1,6 @@
|
|||
devstack_base_dir: /opt/stack
|
||||
tempest_test_regex: ''
|
||||
tox_envlist: smoke
|
||||
# TODO(kopecmartin) remove tempest_black_regex once all consumers of this
|
||||
# role have switched to the tempest_exclude_regex option.
|
||||
tempest_black_regex: ''
|
||||
tempest_exclude_regex: ''
|
||||
tox_extra_args: ''
|
||||
tempest_test_timeout: ''
|
||||
stable_constraints_file: "{{ devstack_base_dir }}/requirements/upper-constraints.txt"
|
||||
|
|
|
@ -70,22 +70,16 @@
|
|||
# TODO(kopecmartin) remove this after all consumers of the role have switched
|
||||
# to tempest_exclude_regex option, until then it's kept here for the backward
|
||||
# compatibility
|
||||
- name: Set tempest_exclude_regex
|
||||
- name: Build exclude regex (old param)
|
||||
set_fact:
|
||||
tempest_exclude_regex: "{{ tempest_black_regex }}"
|
||||
tempest_test_exclude_regex: "--black-regex={{tempest_black_regex|quote}}"
|
||||
when:
|
||||
- tempest_black_regex is defined
|
||||
- tempest_exclude_regex is not defined
|
||||
|
||||
- name: Build exclude regex (old param)
|
||||
set_fact:
|
||||
tempest_exclude_regex: "--black-regex={{tempest_black_regex|quote}}"
|
||||
when:
|
||||
- tempest_black_regex is defined
|
||||
|
||||
- name: Build exclude regex (new param)
|
||||
set_fact:
|
||||
tempest_exclude_regex: "--exclude-regex={{tempest_exclude_regex|quote}}"
|
||||
tempest_test_exclude_regex: "--exclude-regex={{tempest_exclude_regex|quote}}"
|
||||
when:
|
||||
- tempest_black_regex is not defined
|
||||
- tempest_exclude_regex is defined
|
||||
|
@ -94,7 +88,7 @@
|
|||
command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} \
|
||||
{{blacklist_option|default('')}} {{exclude_list_option|default('')}} \
|
||||
--concurrency={{tempest_concurrency|default(default_concurrency)}} \
|
||||
{{tempest_exclude_regex|default('')}}
|
||||
{{tempest_test_exclude_regex|default('')}}
|
||||
args:
|
||||
chdir: "{{devstack_base_dir}}/tempest"
|
||||
register: tempest_run_result
|
||||
|
|
Loading…
Reference in New Issue