Fix pifpaf not returning error code upon test failure
For whatever reason, the following command: pifpaf run postgresql -- <test command> is not returning a non-zero error code on test failure. (An example print out is included below.) This PS updates pretty_tox.sh to forcibly raise a non-zero error code in the event of test failure. It also renames the script to run_pifpaf.sh to be more intuitive. Example: ====== Totals ====== Ran: 7 tests in 5.7673 sec. - Passed: 6 - Skipped: 0 - Expected Fail: 0 - Unexpected Success: 0 - Failed: 1 Sum of execute time for each test: 2.6962 sec. ============== Worker Balance ============== - Worker 0 (7 tests) => 0:00:02.698323 + exit 0 py35: commands succeeded congratulations :) Change-Id: I7b1fa9d42295d06752997f251a0ec14082b44d03
This commit is contained in:
parent
2620913499
commit
ba1fe1c9ec
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
TESTRARGS=$1
|
|
||||||
|
|
||||||
# --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
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script is used for guaranteeing that `pifpaf` returns non-zero codes
|
||||||
|
# upon test failure.
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
pifpaf_stop
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# Instantiate an ephemeral PostgreSQL DB and print out the `pifpaf` environment
|
||||||
|
# variables for debugging purposes.
|
||||||
|
set -ex
|
||||||
|
eval `pifpaf run postgresql`
|
||||||
|
env | grep PIFPAF
|
||||||
|
set +ex
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
TESTRARGS=$1
|
||||||
|
|
||||||
|
python setup.py testr --slowest --testr-args="--subunit --concurrency=1 $TESTRARGS" | subunit-trace -f
|
4
tox.ini
4
tox.ini
|
@ -21,12 +21,12 @@ commands =
|
||||||
[testenv:py27]
|
[testenv:py27]
|
||||||
commands =
|
commands =
|
||||||
{[testenv]commands}
|
{[testenv]commands}
|
||||||
pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}'
|
{toxinidir}/tools/run_pifpaf.sh '{posargs}'
|
||||||
|
|
||||||
[testenv:py35]
|
[testenv:py35]
|
||||||
commands =
|
commands =
|
||||||
{[testenv]commands}
|
{[testenv]commands}
|
||||||
pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}'
|
{toxinidir}/tools/run_pifpaf.sh '{posargs}'
|
||||||
|
|
||||||
[testenv:functional]
|
[testenv:functional]
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
|
|
Loading…
Reference in New Issue