python-openstackclient/functional/harpoon.sh
Steve Martinelli 742982af4b Add functional tests to osc
Create a script that kicks off function tests that exercise
openstackclient commands against a cloud.

If no keystone/openstack process is detected, a devstack instance
is spun up and the tests are run against that.

There is also a hook added to tox.ini so that we can run these
tests easily from a gate job.

Change-Id: I3cc8b2b800de7ca74af506d2c7e8ee481fa985f0
2014-10-01 19:46:07 -04:00

31 lines
640 B
Bash
Executable File

#!/bin/bash
FUNCTIONAL_TEST_DIR=$(cd $(dirname "$0") && pwd)
source $FUNCTIONAL_TEST_DIR/harpoonrc
OPENSTACKCLIENT_DIR=$FUNCTIONAL_TEST_DIR/..
if [[ -z $DEVSTACK_DIR ]]; then
echo "guessing location of devstack"
DEVSTACK_DIR=$OPENSTACKCLIENT_DIR/../devstack
fi
function setup_credentials {
RC_FILE=$DEVSTACK_DIR/accrc/$HARPOON_USER/$HARPOON_TENANT
source $RC_FILE
echo 'sourcing' $RC_FILE
echo 'running tests with'
env | grep OS
}
function run_tests {
cd $FUNCTIONAL_TEST_DIR
python -m testtools.run discover
rvalue=$?
cd $OPENSTACKCLIENT_DIR
exit $rvalue
}
setup_credentials
run_tests