Migrate to stestr

This is effectively os-testr but maintained.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I97183318f715b03f31145fa3d0f00bb7bc8a0c82
This commit is contained in:
Stephen Finucane 2022-03-22 11:46:33 +00:00
parent 11eb43d68e
commit 63c3466f29
8 changed files with 38 additions and 38 deletions

2
.gitignore vendored
View File

@ -5,7 +5,7 @@
.*.swp
.*sw?
.coverage
.testrepository
.stestr
.tox
AUTHORS
build/*

12
.stestr.conf Normal file
View File

@ -0,0 +1,12 @@
[DEFAULT]
test_path=${OS_TEST_PATH:-./aodh/tests/unit}
top_dir=./
# 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
group_regex=(gabbi\.(suitemaker|driver)\.test_gabbi_([^_]+))_

View File

@ -1,9 +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:-600} \
${PYTHON:-python} -m subunit.run discover ${OS_TEST_PATH:-./aodh/tests} -t . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list
# NOTE(chdent): Only used/matches on gabbi-related tests.
group_regex=(gabbi\.(suitemaker|driver)\.test_gabbi_([^_]+))_

View File

@ -6,8 +6,8 @@ cleanup(){
}
trap cleanup EXIT
export OS_TEST_PATH=aodh/tests/functional_live
export GABBI_LIVE_FAIL_IF_NO_TEST=1
export OS_TEST_PATH=aodh/tests/functional_live/
export AODH_SERVICE_TOKEN=foobar # Needed for gabbi
export AODH_SERVICE_ROLES=admin
@ -15,6 +15,6 @@ AODH_TEST_DRIVERS=${AODH_TEST_DRIVERS:-postgresql}
for indexer in ${AODH_TEST_DRIVERS}
do
eval $(pifpaf -e DATABASE run $indexer)
pifpaf -e AODH run aodh --database-url $DATABASE_URL -- ./tools/pretty_tox.sh $*
pifpaf -e AODH run aodh --database-url $DATABASE_URL -- stestr run $*
cleanup
done

View File

@ -2,11 +2,11 @@
set -e
export OS_TEST_PATH=aodh/tests/unit
./tools/pretty_tox.sh $*
stestr run $*
export OS_TEST_PATH=aodh/tests/functional
AODH_TEST_DRIVERS=${AODH_TEST_DRIVERS:-postgresql}
for indexer in ${AODH_TEST_DRIVERS}
do
pifpaf -g AODH_TEST_STORAGE_URL run $indexer -- ./tools/pretty_tox.sh $*
pifpaf -g AODH_TEST_STORAGE_URL run $indexer -- stestr run $*
done

View File

@ -45,12 +45,11 @@ zaqar =
test =
pifpaf[gnocchi]>=1.0.1
os-testr>=0.4.1 # Apache-2.0
stestr>=2.0.0 # Apache-2.0
oslotest>=2.15.0 # Apache-2.0
coverage>=3.6
fixtures>=1.3.1
sqlalchemy-utils
testrepository>=0.0.18
testresources>=0.2.4 # Apache-2.0/BSD
gabbi>=1.30.0 # Apache-2.0
# Provides subunit-trace

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -o pipefail
TESTRARGS=$*
# --until-failure is not compatible with --subunit see:
#
# https://bugs.launchpad.net/testrepository/+bug/1411804
#
# this work around exists until that is addressed
if [[ "$TESTARGS" =~ "until-failure" ]]; then
python setup.py testr --slowest --testr-args="$TESTRARGS"
else
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f
fi

26
tox.ini
View File

@ -8,6 +8,10 @@ ignore_basepython_conflict = True
basepython = python3
usedevelop = True
setenv =
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=600
AODH_TEST_DRIVERS=postgresql mysql
mysql: AODH_TEST_DRIVERS=mysql
postgresql: AODH_TEST_DRIVERS=postgresql
@ -16,18 +20,28 @@ setenv =
mysql: AODH_TEST_DEPS=mysql
postgresql: AODH_TEST_DEPS=postgresql
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
.[test,{env:AODH_TEST_DEPS}]
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
.[test,{env:AODH_TEST_DEPS}]
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE AODH_TEST_DRIVERS
commands =
{toxinidir}/run-tests.sh {posargs}
{toxinidir}/run-functional-tests.sh "{posargs}"
aodh-config-generator
{toxinidir}/run-tests.sh {posargs}
{toxinidir}/run-functional-tests.sh {posargs}
aodh-config-generator
allowlist_externals = bash
[testenv:cover]
setenv =
{[testenv]setenv}
PYTHON=coverage run --source aodh --parallel-mode
commands =
pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --slowest --coverage --testr-args="{posargs}"
coverage erase
stestr run {posargs}
stestr --test-path=./aodh/tests/functional run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
pifpaf -g AODH_TEST_STORAGE_URL run mysql -- stestr --test-path=./aodh/tests run
coverage report
[testenv:pep8]