Skip to content

Commit

Permalink
Finish stestr migration
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mtreinish committed Nov 24, 2017
1 parent 8628c75 commit 9c56c78
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 51 deletions.
3 changes: 1 addition & 2 deletions .stestr.conf
Original file line number Diff line number Diff line change
@@ -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(?:\.|_)([^_]+)
18 changes: 0 additions & 18 deletions .testr.conf

This file was deleted.

3 changes: 1 addition & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests-functional-py3.txt

This file was deleted.

15 changes: 0 additions & 15 deletions tools/pretty_tox3.sh

This file was deleted.

39 changes: 26 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,21 @@ 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}'
env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler'
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'


Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 9c56c78

Please sign in to comment.