Skip to content

Commit e2f745b

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "add support for running tests with master dependencies"
2 parents afba783 + d98b72c commit e2f745b

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# This is a script that kicks off a series of functional tests against an
4+
# OpenStack cloud. It will attempt to create an instance if one is not
5+
# available. Do not run this script unless you know what you're doing.
6+
# For more information refer to:
7+
# http://docs.openstack.org/developer/python-openstackclient/
8+
9+
# This particular script differs from the normal post_test_hook because
10+
# it installs the master (tip) version of osc-lib and openstacksdk
11+
12+
function generate_testr_results {
13+
if [ -f .testrepository/0 ]; then
14+
sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
15+
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
16+
sudo .tox/functional/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
17+
sudo gzip -9 $BASE/logs/testrepository.subunit
18+
sudo gzip -9 $BASE/logs/testr_results.html
19+
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
20+
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
21+
fi
22+
}
23+
24+
export OPENSTACKCLIENT_DIR="$BASE/new/python-openstackclient"
25+
sudo chown -R jenkins:stack $OPENSTACKCLIENT_DIR
26+
27+
# Go to the openstackclient dir
28+
cd $OPENSTACKCLIENT_DIR
29+
30+
# Run tests
31+
echo "Running openstackclient functional test suite"
32+
set +e
33+
34+
# Source environment variables to kick things off
35+
source ~stack/devstack/openrc admin admin
36+
echo 'Running tests with:'
37+
env | grep OS
38+
39+
# Preserve env for OS_ credentials
40+
sudo -E -H -u jenkins tox -e functional-tips
41+
EXIT_CODE=$?
42+
set -e
43+
44+
# Collect and parse result
45+
generate_testr_results
46+
exit $EXIT_CODE

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ commands =
5454
setenv = OS_TEST_PATH=./openstackclient/tests/functional
5555
passenv = OS_*
5656

57+
[testenv:functional-tips]
58+
setenv = OS_TEST_PATH=./openstackclient/tests/functional
59+
passenv = OS_*
60+
commands =
61+
pip install -q -U -e "git+https://git.openstack.org/openstack/osc-lib.git#egg=osc_lib"
62+
pip install -q -U -e "git+https://git.openstack.org/openstack/python-openstacksdk.git#egg=python_openstacksdk"
63+
pip install -q -U -e "git+https://git.openstack.org/openstack/os-client-config.git#egg=os_client_config"
64+
ostestr {posargs}
65+
5766
[testenv:venv]
5867
commands = {posargs}
5968

0 commit comments

Comments
 (0)