Set regex flag on ostestr command for osprofiler tests

In the unit test tox jobs we run the whole test suite first and after
that exits successfully we also run the osprofiler tests while setting
an osprofiler env variable to enable osprofiler. However the regex isn't
being set properly in ostestr, you set the selection regex with the
--regex flag. [1] This only works by chance because ostestr will pass
any unrecognized args to the subprocess used to run testr internally,
and testr leverages that as a regex. But in the latest os-testr release
it doesn't subprocess internally anymore and this doesn't work. This
commit fixes things to properly set the regex in ostestr so it works in
both old and new versions.

The order of the test runs is also switched because we capture the last
test run's subunit for openstack-health and other analysis, so we want
to full test run to be used for this.

[1] https://docs.openstack.org/os-testr/latest/user/ostestr.html#test-selection

Change-Id: I890505d65ca6043ddbdcc5895f2620391b505756
(cherry picked from commit ce8ffc5303)
This commit is contained in:
Matthew Treinish 2017-09-07 15:04:02 -04:00 committed by Matt Riedemann
parent bac80e3e78
commit bb7628fdf3
1 changed files with 2 additions and 2 deletions

View File

@ -26,14 +26,14 @@ passenv = OS_DEBUG GENERATE_HASHES
[testenv:py27]
commands =
{[testenv]commands}
env TEST_OSPROFILER=1 ostestr --regex 'nova.tests.unit.test_profiler'
ostestr '{posargs}'
env TEST_OSPROFILER=1 ostestr 'nova.tests.unit.test_profiler'
[testenv:py35]
commands =
{[testenv]commands}
env TEST_OSPROFILER=1 ostestr --regex 'nova.tests.unit.test_profiler'
bash tools/pretty_tox3.sh '{posargs}'
env TEST_OSPROFILER=1 ostestr 'nova.tests.unit.test_profiler'
[testenv:pep8]
basepython = python2.7