From d98b72c245a71ce289a7e18069fabfc433893914 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Wed, 11 Jan 2017 11:21:21 -0500 Subject: [PATCH] add support for running tests with master dependencies we can create a new infra job that points to the new test hook, which should install the master version of the SDK, osc-lib and os-client-config. Change-Id: Ib6391893b2302bdc514525d5ddda886fe8c60100 --- .../tests/functional/post_test_hook_tips.sh | 46 +++++++++++++++++++ tox.ini | 9 ++++ 2 files changed, 55 insertions(+) create mode 100755 openstackclient/tests/functional/post_test_hook_tips.sh diff --git a/openstackclient/tests/functional/post_test_hook_tips.sh b/openstackclient/tests/functional/post_test_hook_tips.sh new file mode 100755 index 0000000000..994142d883 --- /dev/null +++ b/openstackclient/tests/functional/post_test_hook_tips.sh @@ -0,0 +1,46 @@ +#!/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/ + +# This particular script differs from the normal post_test_hook because +# it installs the master (tip) version of osc-lib and openstacksdk + +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 +} + +export OPENSTACKCLIENT_DIR="$BASE/new/python-openstackclient" +sudo chown -R jenkins:stack $OPENSTACKCLIENT_DIR + +# Go to the openstackclient dir +cd $OPENSTACKCLIENT_DIR + +# Run tests +echo "Running openstackclient functional test suite" +set +e + +# Source environment variables to kick things off +source ~stack/devstack/openrc admin admin +echo 'Running tests with:' +env | grep OS + +# Preserve env for OS_ credentials +sudo -E -H -u jenkins tox -e functional-tips +EXIT_CODE=$? +set -e + +# Collect and parse result +generate_testr_results +exit $EXIT_CODE diff --git a/tox.ini b/tox.ini index af7120e11e..e7bb652762 100644 --- a/tox.ini +++ b/tox.ini @@ -54,6 +54,15 @@ commands = setenv = OS_TEST_PATH=./openstackclient/tests/functional passenv = OS_* +[testenv:functional-tips] +setenv = OS_TEST_PATH=./openstackclient/tests/functional +passenv = OS_* +commands = + pip install -q -U -e "git+https://git.openstack.org/openstack/osc-lib.git#egg=osc_lib" + pip install -q -U -e "git+https://git.openstack.org/openstack/python-openstacksdk.git#egg=python_openstacksdk" + pip install -q -U -e "git+https://git.openstack.org/openstack/os-client-config.git#egg=os_client_config" + ostestr {posargs} + [testenv:venv] commands = {posargs}