Fix default values for variables in run-tempest role

With the new version of tox the parsing of postargs value has changed.
Previously an empty string was discarded by tox if it appeared in the
postargs value in contrast with the latest version of tox which
leaves the empty string intact.

The behavior of the latest tox version makes some jobs fail as some
variables in the run-tempest role have an empty string as a default
value. This leads in some cases to the execution of an incorrect tempest
command, for example:

tempest run --regex '[.*\bsmoke\b.*]' '' --concurrency=2

The patch changes the default value for blacklist_option,
exclude_list_option and tempest_test_regex variables to None to prevent
an empty string from being passed to postargs variable in tox.

Change-Id: I006e33c5ea0753b68cf1feb8580cb029209af9a8
This commit is contained in:
Lukáš Piwowarski 2023-01-06 09:57:04 +01:00 committed by Martin Kopec
parent 7416b91cf7
commit bd6481d934
2 changed files with 7 additions and 4 deletions

View File

@ -62,7 +62,9 @@
when: blacklist_stat.stat.exists
- name: Run Tempest
command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} {{blacklist_option|default('')}} \
command: tox -e {{tox_envlist}} {{tox_extra_args}} -- \
{{tempest_test_regex|quote if (tempest_test_regex|length>0)|default(None, True)}} \
{{blacklist_option|default(None)}} \
--concurrency={{tempest_concurrency|default(default_concurrency)}} \
--black-regex={{tempest_black_regex|quote}}
args:

View File

@ -120,10 +120,11 @@
- target_branch in ["stable/train", "stable/ussuri", "stable/victoria"]
- name: Run Tempest
command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} \
{{blacklist_option|default('')}} {{exclude_list_option|default('')}} \
command: tox -e {{tox_envlist}} {{tox_extra_args}} -- \
{{tempest_test_regex|quote if (tempest_test_regex|length>0)|default(None, True)}} \
{{blacklist_option|default(None)}} {{exclude_list_option|default(None)}} \
--concurrency={{tempest_concurrency|default(default_concurrency)}} \
{{tempest_test_exclude_regex|default('')}}
{{tempest_test_exclude_regex|default(None)}}
args:
chdir: "{{devstack_base_dir}}/tempest"
register: tempest_run_result