summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaspars Skels <kaspars.skels@att.com>2019-09-05 13:01:39 -0500
committerKaspars Skels <kaspars.skels@att.com>2019-09-05 13:24:50 -0500
commit7ab8f4b117ec88700faa80c4d368c6b8e9f2eca3 (patch)
tree9d3412be1d447bb5b87f886c3cb7152b46479a5b
parent4690a02e940d547caa61060be4d3f294c135e08c (diff)
Add wrapper script for functional tests (Functest)
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>
-rwxr-xr-xtools/test.sh67
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/test.sh b/tools/test.sh
new file mode 100755
index 0000000..256c82f
--- /dev/null
+++ b/tools/test.sh
@@ -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
+