diff options
Diffstat (limited to 'docker/prepare_env.sh')
-rwxr-xr-x | docker/prepare_env.sh | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh index eaa9b4f0..42b1e1c4 100755 --- a/docker/prepare_env.sh +++ b/docker/prepare_env.sh @@ -7,15 +7,47 @@ # and run the tests automatically # +usage="Script to prepare the Functest environment. + +usage: + bash $(basename "$0") [--offline] [-h|--help] [-t <test_name>] + +where: + -o|--offline optional offline mode (experimental) + -h|--help show this help text + +examples: + $(basename "$0") + $(basename "$0") --offline" + +offline=false + +# Parse parameters +while [[ $# > 0 ]] + do + key="$1" + case $key in + -h|--help) + echo "$usage" + exit 0 + shift + ;; + -o|--offline) + offline=true + ;; + *) + error "unknown option $1" + exit 1 + ;; + esac + shift # past argument or value +done + BASEDIR=`dirname $0` source ${BASEDIR}/common.sh # Support for Functest offline # NOTE: Still not 100% working when running the tests -offline=false -if [ ! -z "$1" ] && [ $1 == "--offline" ]; then - offline=true -fi info "######### Preparing Functest environment #########" if [ $offline == false ]; then @@ -86,8 +118,6 @@ mkdir -p ${FUNCTEST_CONF_DIR} mkdir -p ${FUNCTEST_DATA_DIR} mkdir -p ${FUNCTEST_RESULTS_DIR}/ODL -# Detect type of installer -# NOTE: this is tricky, since the IPs will have to be the same ALWAYS # Create Openstack credentials file @@ -95,7 +125,7 @@ ${REPOS_DIR}/releng/utils/fetch_os_creds.sh -d ${FUNCTEST_CONF_DIR}/openstack.cr -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} retval=$? if [ $retval != 0 ]; then - echo "Cannot retrieve credentials file from installation. Check logs." + error "Cannot retrieve credentials file from installation. Check logs." exit $retval fi @@ -105,11 +135,11 @@ source ${FUNCTEST_CONF_DIR}/openstack.creds # Prepare Functest Environment -echo "Functest: prepare Functest environment" +info "Functest: prepare Functest environment" python ${FUNCTEST_REPO_DIR}/testcases/config_functest.py --debug ${FUNCTEST_REPO_DIR}/ start retval=$? if [ $retval != 0 ]; then - echo "Error when configuring Functest environment" + error "Error when configuring Functest environment" exit $retval fi |