Add wrapper script for functional tests (Functest) 50/68450/4
authorKaspars Skels <kaspars.skels@att.com>
Thu, 5 Sep 2019 18:01:39 +0000 (13:01 -0500)
committerKaspars Skels <kaspars.skels@att.com>
Thu, 5 Sep 2019 18:24:50 +0000 (13:24 -0500)
This enables running healthcheck and smoke tests for intel-pod17
https://wiki.opnfv.org/pages/viewpage.action?pageId=29098314

Change-Id: Ibb40aa12f8c8ba5f1aee68554acae2edd722bd80
Signed-off-by: Kaspars Skels <kaspars.skels@att.com>
tools/test.sh [new file with mode: 0755]

diff --git a/tools/test.sh b/tools/test.sh
new file mode 100755 (executable)
index 0000000..256c82f
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+set -e
+
+# Implements run of the OPNFV functional tests (Functest)
+# https://wiki.opnfv.org/pages/viewpage.action?pageId=29098314
+
+export FUNCTEST_CACHE=${FUNCTEST_CACHE:-"${HOME}/.opnfv/functest"}
+
+TMP_DIR=$(mktemp -d)
+cd $TMP_DIR
+
+trap "{ sudo rm -rf $TMP_DIR; }" EXIT
+
+
+touch env
+
+cat > openstack.creds << EOF
+export OS_AUTH_URL='http://identity-airship.intel-pod17.opnfv.org:80/v3'
+export OS_USER_DOMAIN_NAME=default
+export OS_PROJECT_DOMAIN_NAME=default
+export OS_USERNAME=admin
+export OS_PROJECT_NAME=admin
+export OS_PASSWORD=password123
+export OS_IDENTITY_API_VERSION=3
+EOF
+
+# check/download images
+if [ ! -d $FUNCTEST_CACHE ]; then
+  mkdir -p $FUNCTEST_CACHE/images && cd $FUNCTEST_CACHE
+  wget -q -O- https://git.opnfv.org/functest/plain/functest/ci/download_images.sh?h=stable/hunter | bash -s -- images
+  cd $TMP_DIR
+fi
+
+
+help() {
+  echo "Usage: $0 <healthcheck|smoke>"
+}
+
+
+run_healthcheck_tests() {
+  sudo docker run --env-file env \
+      -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
+      -v ${FUNCTEST_CACHE}/images:/home/opnfv/functest/images \
+      opnfv/functest-healthcheck:hunter
+}
+
+run_smoke_tests() {
+  sudo docker run --env-file env \
+      -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
+      -v ${FUNCTEST_CACHE}/images:/home/opnfv/functest/images \
+      opnfv/functest-smoke:hunter
+}
+
+
+case "$1" in
+'healthcheck')
+  run_healthcheck_tests
+  ;;
+'smoke')
+  run_smoke_tests
+  ;;
+*) help
+   exit 1
+  ;;
+esac
+