Collect test result reports
Fix the post_test_hook.sh and tox.ini to use right tox enviroment. Post_test_hook.sh collects the result reports. Change-Id: Ie60cd55521d89cb2e00f3ecff0fe3af989e0f6ea Closes-bug: 1559861
This commit is contained in:
parent
8b0d413b1c
commit
8bdccea2bb
@ -14,26 +14,65 @@
|
||||
|
||||
# This script is executed inside post_test_hook function in devstack gate.
|
||||
|
||||
VENV=${1:-"dsvm-functional"}
|
||||
set -xe
|
||||
|
||||
export GATE_DEST=$BASE/new
|
||||
export DEVSTACK_DIR=$GATE_DEST/devstack
|
||||
export TACKER_DIR="$GATE_DEST/tacker"
|
||||
TACKER_DIR="$BASE/new/tacker"
|
||||
SCRIPTS_DIR="/usr/os-testr-env/bin/"
|
||||
|
||||
case $VENV in
|
||||
dsvm-functional)
|
||||
venv=${1:-"dsvm-functional"}
|
||||
|
||||
function generate_test_logs {
|
||||
local path="$1"
|
||||
# Compress all $path/*.txt files and move the directories holding those
|
||||
# files to /opt/stack/logs. Files with .log suffix have their
|
||||
# suffix changed to .txt (so browsers will know to open the compressed
|
||||
# files and not download them).
|
||||
if [ -d "$path" ]
|
||||
then
|
||||
sudo find $path -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \;
|
||||
sudo mv $path/* /opt/stack/logs/
|
||||
fi
|
||||
}
|
||||
|
||||
function generate_testr_results {
|
||||
# Give job user rights to access tox logs
|
||||
sudo -H -u $owner chmod o+rw .
|
||||
sudo -H -u $owner chmod o+rw -R .testrepository
|
||||
if [ -f ".testrepository/0" ] ; then
|
||||
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./testrepository.subunit
|
||||
$SCRIPTS_DIR/subunit2html ./testrepository.subunit testr_results.html
|
||||
gzip -9 ./testrepository.subunit
|
||||
gzip -9 ./testr_results.html
|
||||
sudo mv ./*.gz /opt/stack/logs/
|
||||
fi
|
||||
|
||||
if [[ "$venv" == dsvm-functional* ]]
|
||||
then
|
||||
generate_test_logs $log_dir
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [[ "$venv" == dsvm-functional* ]]
|
||||
then
|
||||
owner=stack
|
||||
;;
|
||||
esac
|
||||
sudo_env=
|
||||
log_dir="/tmp/${venv}-logs"
|
||||
fi
|
||||
|
||||
# Set owner permissions according to job's requirements.
|
||||
cd $TACKER_DIR
|
||||
sudo chown -R $owner:stack $TACKER_DIR
|
||||
|
||||
cd $TACKER_DIR
|
||||
# Run tests
|
||||
echo "Running tacker $venv test suite"
|
||||
set +e
|
||||
|
||||
# Run functional tests
|
||||
echo "Running Tacker $VENV test suite"
|
||||
source $DEVSTACK_DIR/openrc admin admin
|
||||
sudo -E -H -u $owner tox -e functional -- --concurrency=1
|
||||
EXIT_CODE=$?
|
||||
sudo -H -u $owner $sudo_env tox -e $venv
|
||||
testr_exit_code=$?
|
||||
set -e
|
||||
|
||||
# Collect and parse results
|
||||
generate_testr_results
|
||||
exit $testr_exit_code
|
||||
|
||||
exit $EXIT_CODE
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Despite above warning added by global sync process, please use
|
||||
# ascii betical order.
|
||||
|
||||
http://tarballs.openstack.org/python-tackerclient/python-tackerclient-master.tar.gz#egg=python-tackerclient
|
||||
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
|
||||
coverage>=3.6 # Apache-2.0
|
||||
discover # BSD
|
||||
@ -16,6 +16,7 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
ordereddict # MIT
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
os-testr>=0.4.1 # Apache-2.0
|
||||
tempest-lib>=0.14.0 # Apache-2.0
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
testtools>=1.4.0 # MIT
|
||||
|
8
tools/ostestr_compat_shim.sh
Executable file
8
tools/ostestr_compat_shim.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# preserve old behavior of using an arg as a regex when '--' is not present
|
||||
case $@ in
|
||||
(*--*) ostestr $@;;
|
||||
('') ostestr;;
|
||||
(*) ostestr --regex "$@"
|
||||
esac
|
12
tox.ini
12
tox.ini
@ -22,13 +22,19 @@ commands =
|
||||
python -m tacker.openstack.common.lockutils python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:functional]
|
||||
sitepackages = True
|
||||
setenv = OS_TEST_PATH=./tacker/tests/functional
|
||||
commands =
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
|
||||
[testenv:dsvm-functional]
|
||||
basepython = python2.7
|
||||
setenv = {[testenv]setenv}
|
||||
{[testenv:functional]setenv}
|
||||
deps =
|
||||
{[testenv:functional]deps}
|
||||
commands =
|
||||
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
|
||||
|
||||
[tox:jenkins]
|
||||
sitepackages = True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user