tests: simplify tox config

This runs most of the functional tests in the normal tox target.
(all except those tagged live).

Change-Id: Icf69ff743ba223c1b08abe858f567babfaaa64cf
This commit is contained in:
Mehdi Abaakouk 2017-04-28 10:27:12 +02:00
parent 29c0ecd54b
commit cf15d5a9de
5 changed files with 33 additions and 35 deletions

View File

@ -2877,8 +2877,8 @@ class TestAlarmsCompositeRule(TestAlarmsBase):
expect_errors=True,
headers=self.auth_headers)
faultstring = ("Invalid input for field/attribute threshold. "
"Value: 'False'. Wrong type. Expected '<type '"
"float'>', got '<type 'bool'>'")
"Value: 'False'. Wrong type. Expected '%s', got '%s'"
% (type(1.0), type(True)))
self.assertEqual(faultstring,
response.json['error_message']['faultstring'])

5
bindep.txt Normal file
View File

@ -0,0 +1,5 @@
libpq-dev [platform:dpkg]
postgresql [platform:dpkg]
mysql-client [platform:dpkg]
mysql-server [platform:dpkg]
gettext [platform:dpkg]

7
run-tests.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash -x
set -e
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 $*
done

View File

@ -2,7 +2,7 @@
set -o pipefail
TESTRARGS=$1
TESTRARGS=$*
# --until-failure is not compatible with --subunit see:
#
@ -10,7 +10,7 @@ TESTRARGS=$1
#
# this work around exists until that is addressed
if [[ "$TESTARGS" =~ "until-failure" ]]; then
python setup.py testr --slowest --testr-args="$TESTRARGS"
ostestr --slowest $TESTRARGS
else
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f
ostestr --no-pretty --slowest --subunit $TESTRARGS | subunit-trace -f
fi

46
tox.ini
View File

@ -1,32 +1,28 @@
[tox]
minversion = 1.6
skipsdist = True
envlist = py35,py27,pep8
envlist = py{27,35}{,-mysql,-postgresql,-pgsql},functional,pep8
[testenv]
deps = .[test]
# NOTE(tonyb): This project has chosen to *NOT* consume upper-constraints.txt
install_command = pip install -U {opts} {packages}
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=aodh/tests/unit
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE
setenv =
AODH_TEST_DRIVERS=postgresql mysql
mysql: AODH_TEST_DRIVERS=mysql
postgresql: AODH_TEST_DRIVERS=postgresql
AODH_TEST_DEPS=postgresql,mysql
mysql: AODH_TEST_DEPS=mysql
postgresql: AODH_TEST_DEPS=postgresql
# TODO(sileht): Remove when infra job are removed
pgsql: AODH_TEST_DRIVERS=postgresql
pgsql: AODH_TEST_DEPS=postgresql
deps = .[test,{env:AODH_TEST_DEPS}]
passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE AODH_TEST_DRIVERS
commands =
python setup.py testr --slowest --testr-args="{posargs}"
{toxinidir}/run-tests.sh --black-regex '^aodh\.tests\.tempest\..*$' {posargs}
oslo-config-generator --config-file=etc/aodh/aodh-config-generator.conf
whitelist_externals = bash
[testenv:py27-mysql]
deps = .[mysql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands =
pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --slowest --testr-args="{posargs}"
[testenv:py27-pgsql]
deps = .[postgresql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/
commands =
pifpaf -g AODH_TEST_STORAGE_URL run postgresql -- python setup.py testr --slowest --testr-args="{posargs}"
[testenv:functional]
deps = .[mysql,postgresql,test]
@ -37,16 +33,6 @@ passenv = {[testenv]passenv} AODH_*
commands =
{toxinidir}/run-functional-tests.sh ./tools/pretty_tox.sh "{posargs}"
# NOTE(chdent): The gabbi tests are also run under the primary tox
# targets. This target simply provides a target to directly run just
# gabbi tests without needing to discovery across the entire body of
# tests.
[testenv:gabbi]
deps = .[mysql,test]
setenv = OS_TEST_PATH=aodh/tests/functional/gabbi
commands =
pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --testr-args="{posargs}"
[testenv:cover]
commands =
pifpaf -g AODH_TEST_STORAGE_URL run mysql -- python setup.py testr --slowest --coverage --testr-args="{posargs}"