|
| 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 |
0 commit comments