2014-09-19 02:42:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This is a script that kicks off a series of functional tests against an
|
|
|
|
# OpenStack cloud. It will attempt to create an instance if one is not
|
|
|
|
# available. Do not run this script unless you know what you're doing.
|
|
|
|
# For more information refer to:
|
|
|
|
# http://docs.openstack.org/developer/python-openstackclient/
|
|
|
|
|
2016-06-15 14:25:51 -04:00
|
|
|
function generate_testr_results {
|
|
|
|
if [ -f .testrepository/0 ]; then
|
|
|
|
sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
|
|
|
|
sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
|
|
|
|
sudo .tox/functional/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
|
|
|
|
sudo gzip -9 $BASE/logs/testrepository.subunit
|
|
|
|
sudo gzip -9 $BASE/logs/testr_results.html
|
|
|
|
sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
|
|
|
|
sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
|
|
|
|
fi
|
|
|
|
}
|
2014-09-19 02:42:55 +00:00
|
|
|
|
|
|
|
OPENSTACKCLIENT_DIR=$(cd $(dirname "$0") && pwd)
|
2016-06-15 14:25:51 -04:00
|
|
|
sudo chown -R jenkins:stack $OPENSTACKCLIENT_DIR
|
2014-09-19 02:42:55 +00:00
|
|
|
|
2016-06-15 14:25:51 -04:00
|
|
|
# Run tests
|
2014-09-19 02:42:55 +00:00
|
|
|
echo "Running openstackclient functional test suite"
|
2016-06-15 14:25:51 -04:00
|
|
|
set +e
|
|
|
|
|
|
|
|
# Go to the openstackclient dir
|
|
|
|
cd $OPENSTACKCLIENT_DIR
|
|
|
|
|
|
|
|
# Source environment variables to kick things off
|
2015-10-08 02:10:39 -04:00
|
|
|
source ~stack/devstack/openrc admin admin
|
2015-04-16 12:56:40 -06:00
|
|
|
echo 'Running tests with:'
|
2016-06-15 14:25:51 -04:00
|
|
|
env | grep OS
|
|
|
|
|
|
|
|
# Preserve env for OS_ credentials
|
|
|
|
sudo -E -H -u jenkins tox -efunctional
|
|
|
|
EXIT_CODE=$?
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Collect and parse result
|
|
|
|
generate_testr_results
|
|
|
|
exit $EXIT_CODE
|