Finish stestr migration

Nova switched to using stestr for all it's in tree testing except for
the coverage job. This commit updates that job so it also uses stestr
and cleans up the last bits of testr setup left in tree. As part of
this change this moves all the one off per job configuration into the
tox job definitions instead of hiding it in either the .stestr.conf or
in a wrapper script.

Change-Id: I36e0e791d485b44641a1ed8770eca8e95aca19be
This commit is contained in:
Matthew Treinish 2017-11-21 19:01:11 -05:00
parent 8628c75738
commit 9c56c78513
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
6 changed files with 28 additions and 51 deletions

View File

@ -1,4 +1,3 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./nova/tests}
test_path=./nova/tests/unit
top_dir=./
group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+)

View File

@ -1,18 +0,0 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./nova/tests} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
# NOTE(cdent): The group_regex describes how testrepository will
# group tests into the same process when running concurently. The
# following insures that gabbi tests coming from the same YAML file
# are all in the same process. This is important because each YAML
# file represents an ordered sequence of HTTP requests. Note that
# tests which do not match this regex will not be grouped in any
# special way. See the following for more details.
# http://testrepository.readthedocs.io/en/latest/MANUAL.html#grouping-tests
# https://gabbi.readthedocs.io/en/latest/#purpose
group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+)

View File

@ -18,9 +18,8 @@ sphinxcontrib-actdiag>=0.8.5 # BSD
sphinxcontrib-seqdiag>=0.8.4 # BSD
os-api-ref>=1.4.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testresources>=2.0.0 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT

View File

@ -1 +0,0 @@
# All functional tests currently work with python 3.5.

View File

@ -1,15 +0,0 @@
#!/usr/bin/env bash
TESTRARGS=$1
if [ $OS_TEST_PATH = './nova/tests/functional' ]; then
blacklist_file=tests-functional-py3.txt
else
blacklist_file=tests-py3.txt
fi
if [ -z "$TESTRARGS" ]; then
stestr run --blacklist-file $blacklist_file
else
stestr run "$TESTRARGS"
fi

39
tox.ini
View File

@ -20,14 +20,11 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
commands =
find . -type f -name "*.pyc" -delete
rm -Rf .testrepository/times.dbm
passenv = OS_DEBUG GENERATE_HASHES
# there is also secret magic in subunit-trace which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.
[testenv:py27]
setenv = {[testenv]setenv}
OS_TEST_PATH=./nova/tests/unit
commands =
{[testenv]commands}
stestr run '{posargs}'
@ -35,11 +32,9 @@ commands =
stestr slowest
[testenv:py35]
setenv = {[testenv]setenv}
OS_TEST_PATH=./nova/tests/unit
commands =
{[testenv]commands}
bash tools/pretty_tox3.sh '{posargs}'
stestr run --blacklist-file=tests-py3.txt '{posargs}'
env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler'
@ -68,10 +63,17 @@ commands =
basepython = python2.7
usedevelop = True
setenv = {[testenv]setenv}
OS_TEST_PATH=./nova/tests/functional
commands =
{[testenv]commands}
stestr run '{posargs}'
# NOTE(cdent): The group_regex describes how stestr will group tests into the
# same process when running concurently. The following ensures that gabbi tests
# coming from the same YAML file are all in the same process. This is important
# because each YAML file represents an ordered sequence of HTTP requests. Note
# that tests which do not match this regex will not be grouped in any
# special way. See the following for more details.
# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests
# https://gabbi.readthedocs.io/en/latest/#purpose
stestr --test-path=./nova/tests/functional --group-regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run '{posargs}'
stestr slowest
# TODO(gcb) Merge this into [testenv:functional] when functional tests are gating
@ -80,20 +82,26 @@ commands =
basepython = python3.5
usedevelop = True
setenv = {[testenv]setenv}
OS_TEST_PATH=./nova/tests/functional
commands =
{[testenv]commands}
bash tools/pretty_tox3.sh '{posargs}'
# NOTE(cdent): The group_regex describes how stestr will group tests into the
# same process when running concurently. The following ensures that gabbi tests
# coming from the same YAML file are all in the same process. This is important
# because each YAML file represents an ordered sequence of HTTP requests. Note
# that tests which do not match this regex will not be grouped in any
# special way. See the following for more details.
# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests
# https://gabbi.readthedocs.io/en/latest/#purpose
stestr --test-path=./nova/tests/functional --group-regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run '{posargs}'
[testenv:api-samples]
usedevelop = True
setenv = {[testenv]setenv}
GENERATE_SAMPLES=True
PYTHONHASHSEED=0
OS_TEST_PATH=./nova/tests/functional/api_sample_tests
commands =
find . -type f -name "*.pyc" -delete
stestr run '{posargs}'
stestr --test-path=./nova/tests/functional/api_sample_tests run '{posargs}'
stestr slowest
[testenv:genconfig]
@ -105,10 +113,15 @@ commands = oslopolicy-sample-generator --config-file=etc/nova/nova-policy-genera
[testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage.
setenv = {[testenv]setenv}
PYTHON=coverage run --source nova --parallel-mode
commands =
coverage erase
find . -type f -name "*.pyc" -delete
python setup.py testr --coverage --testr-args='{posargs}'
stestr run '{posargs}'
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:debug]