Skip to content

Commit eba1bc0

Browse files
committed
better functional test collection
straight up copied from glanceclient [1] [1] https://github.com/openstack/python-glanceclient/blob/master/glanceclient/tests/functional/hooks/post_test_hook.sh Change-Id: I9fad6d5c86831a2b872f3a61d4c7fa7383fc1266
1 parent 20ad61b commit eba1bc0

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

post_test_hook.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,38 @@
66
# For more information refer to:
77
# http://docs.openstack.org/developer/python-openstackclient/
88

9-
set -xe
9+
function generate_testr_results {
10+
if [ -f .testrepository/0 ]; then
11+
sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
12+
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
13+
sudo .tox/functional/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
14+
sudo gzip -9 $BASE/logs/testrepository.subunit
15+
sudo gzip -9 $BASE/logs/testr_results.html
16+
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
17+
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
18+
fi
19+
}
1020

1121
OPENSTACKCLIENT_DIR=$(cd $(dirname "$0") && pwd)
22+
sudo chown -R jenkins:stack $OPENSTACKCLIENT_DIR
1223

24+
# Run tests
1325
echo "Running openstackclient functional test suite"
14-
sudo -H -u stack -i <<!
26+
set +e
27+
28+
# Go to the openstackclient dir
29+
cd $OPENSTACKCLIENT_DIR
30+
31+
# Source environment variables to kick things off
1532
source ~stack/devstack/openrc admin admin
1633
echo 'Running tests with:'
17-
env | grep OS_
18-
cd ${OPENSTACKCLIENT_DIR}
19-
tox -e functional
20-
!
34+
env | grep OS
35+
36+
# Preserve env for OS_ credentials
37+
sudo -E -H -u jenkins tox -efunctional
38+
EXIT_CODE=$?
39+
set -e
40+
41+
# Collect and parse result
42+
generate_testr_results
43+
exit $EXIT_CODE

0 commit comments

Comments
 (0)