diff --git a/ceilometer/tests/functional/hooks/post_test_hook.sh b/ceilometer/tests/functional/hooks/post_test_hook.sh index 247fff2ad8..70cdfc8a41 100755 --- a/ceilometer/tests/functional/hooks/post_test_hook.sh +++ b/ceilometer/tests/functional/hooks/post_test_hook.sh @@ -16,7 +16,7 @@ function generate_testr_results { if [ -f .testrepository/0 ]; then - sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit + sudo .tox/py-functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html sudo gzip -9 $BASE/logs/testrepository.subunit @@ -42,7 +42,7 @@ echo "Running ceilometer functional test suite" set +e # NOTE(ityaptin) Expected a script param which contains a backend name -CEILOMETER_TEST_BACKEND="$1" sudo -E -H -u ${STACK_USER:-${USER}} tox -efunctional +CEILOMETER_TEST_BACKEND="$1" sudo -E -H -u ${STACK_USER:-${USER}} tox -epy-functional EXIT_CODE=$? set -e diff --git a/run-functional-tests.sh b/run-functional-tests.sh deleted file mode 100755 index 8ad0a6b477..0000000000 --- a/run-functional-tests.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -x -set -e -# Use a mongodb backend by default - -if [ -z $CEILOMETER_TEST_BACKEND ]; then - CEILOMETER_TEST_BACKEND="mongodb" -fi - -for backend in $CEILOMETER_TEST_BACKEND; do - pifpaf run $backend ./tools/pretty_tox.sh $* -done diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000000..732302b6e7 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e +set -x + +# Use a mongodb backend by default +if [ -z $CEILOMETER_TEST_BACKEND ]; then + CEILOMETER_TEST_BACKEND="mongodb" +fi + +echo +echo "OS_TEST_PATH: $OS_TEST_PATH" +echo "CEILOMETER_TEST_BACKEND: $CEILOMETER_TEST_BACKEND" +echo "CEILOMETER_TEST_DEBUG: $CEILOMETER_TEST_DEBUG" +echo + +if [ "$CEILOMETER_TEST_BACKEND" == "none" ]; then + if [ "$CEILOMETER_TEST_DEBUG" == "True" ]; then + oslo_debug_helper $* + else + ./tools/pretty_tox.sh $* + fi +else + for backend in $CEILOMETER_TEST_BACKEND; do + if [ "$CEILOMETER_TEST_DEBUG" == "True" ]; then + pifpaf --debug run $backend oslo_debug_helper $* + else + pifpaf run $backend ./tools/pretty_tox.sh $* + fi + done +fi diff --git a/tox.ini b/tox.ini index e78ca6fbf7..9778c1e806 100644 --- a/tox.ini +++ b/tox.ini @@ -1,69 +1,39 @@ [tox] -minversion = 1.6 +minversion = 1.8 skipsdist = True -envlist = py34,py27,py35,functional,py34-functional,py35-functional,pep8 +envlist = py{34,27,35},{debug,py,py34,py27,py35}-{mongodb,mysql,pgsql,elastic,functional},pep8 [testenv] deps = .[mongo,mysql,postgresql,gnocchi] -r{toxinidir}/test-requirements.txt - install_command = pip install -U {opts} {packages} usedevelop = True setenv = VIRTUAL_ENV={envdir} OS_TEST_PATH=ceilometer/tests/unit -passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE + CEILOMETER_TEST_BACKEND={env:CEILOMETER_TEST_BACKEND:none} + CEILOMETER_TEST_DEBUG={env:CEILOMETER_TEST_DEBUG:} + debug: CEILOMETER_TEST_DEBUG=True + {mongodb,mysql,pgsql,elastic,functional}: OS_TEST_PATH=ceilometer/tests/functional/ + mongodb: CEILOMETER_TEST_BACKEND=mongodb + mysql: CEILOMETER_TEST_BACKEND=mysql + pgsql: CEILOMETER_TEST_BACKEND=postgresql + elastic: CEILOMETER_TEST_BACKEND=elasticsearch + functional: CEILOMETER_TEST_BACKEND={env:CEILOMETER_TEST_BACKEND:mongodb} +passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE CEILOMETER_* commands = - {toxinidir}/tools/pretty_tox.sh "{posargs}" + bash -x {toxinidir}/run-tests.sh "{posargs}" oslo-config-generator --config-file=etc/ceilometer/ceilometer-config-generator.conf whitelist_externals = bash -[testenv:py-mongodb] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -commands = pifpaf run mongodb {toxinidir}/tools/pretty_tox.sh "{posargs}" - -[testenv:py-mysql] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -commands = pifpaf run mysql {toxinidir}/tools/pretty_tox.sh "{posargs}" - -[testenv:py-pgsql] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -commands = pifpaf run postgresql {toxinidir}/tools/pretty_tox.sh "{posargs}" - -# Functional tests for elastic search -[testenv:py-elastic] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -commands = pifpaf run elasticsearch {toxinidir}/tools/pretty_tox.sh "{posargs}" - -[testenv:functional] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -passenv = CEILOMETER_* -commands = - bash -x {toxinidir}/run-functional-tests.sh "{posargs}" - -[testenv:py34-functional] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -basepython = python3.4 -passenv = CEILOMETER_* -commands = - bash -x {toxinidir}/run-functional-tests.sh "{posargs}" - -[testenv:py35-functional] -setenv = OS_TEST_PATH=ceilometer/tests/functional/ -basepython = python3.5 -passenv = CEILOMETER_* -commands = - bash -x {toxinidir}/run-functional-tests.sh "{posargs}" - [testenv:integration] setenv = OS_TEST_PATH=./ceilometer/tests/integration OS_TEST_TIMEOUT=2400 GABBI_LIVE_FAIL_IF_NO_TEST=1 passenv = {[testenv]passenv} HEAT_* CEILOMETER_* GNOCCHI_* AODH_* GLANCE_* NOVA_* ADMIN_* -# FIXME(sileht): run gabbi-run to failfast in case of error because testr +# NOTE(sileht): run gabbi-run to failfast in case of error because testr # doesn't support --failfast, but we loose the testr report. commands = bash -c 'cd ceilometer/tests/integration/gabbi/gabbits-live && gabbi-run -x < autoscaling.yaml' -# bash -x {toxinidir}/tools/pretty_tox.sh "{posargs}" # NOTE(chdent): The gabbi tests are also run under the other functional # tox targets. This target simply provides a target to directly run just @@ -107,25 +77,6 @@ setenv = PYTHONHASHSEED=0 commands = {posargs} setenv = PYTHONHASHSEED=0 -[testenv:debug] -commands = bash -x oslo_debug_helper {posargs} - -[testenv:debug-mongodb] -setenv = OS_TEST_PATH=ceilometer/tests/functional -commands = pifpaf --debug run mongodb oslo_debug_helper {posargs} - -[testenv:debug-mysql] -setenv = OS_TEST_PATH=ceilometer/tests/functional -commands = pifpaf --debug run mysql oslo_debug_helper {posargs} - -[testenv:debug-pgsql] -setenv = OS_TEST_PATH=ceilometer/tests/functional -commands = pifpaf --debug run postgresql oslo_debug_helper {posargs} - -[testenv:debug-elastic] -setenv = OS_TEST_PATH=ceilometer/tests/functional -commands = pifpaf --debug run elasticsearch oslo_debug_helper {posargs} - [flake8] ignore = exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,install-guide