summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2
diff options
context:
space:
mode:
authorFatih Degirmenci <fdegir@gmail.com>2018-08-31 10:52:00 +0200
committerFatih Degirmenci <fdegir@gmail.com>2018-09-03 09:42:25 +0000
commit92afad5981d84cec20359551209c50a5f6755cb9 (patch)
treefba4b57c5084c85c8c66fef4208d7080b8553ea4 /xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2
parentfb2cbfce4e9a1ea6e60aa2a361e02fdb189042a2 (diff)
Rename functest-prepare role to prepare-tests
This change renames functest prepare-tole to prepare tests and makes other adjustments to the role to move common test preparation steps to its own script so we can prepare for Functest and Yardstick at one go. Similar things are required to be prepared for running Functest and Yardstick such as - installed packages - external network creation - creation of run-functest.sh and run-yardstick scripts from templates - preparation of environment variables This change will fail verification until the changes below is submitted. https://gerrit.opnfv.org/gerrit/#/c/61645/ Change-Id: Id1020d3e61abd3f087863c06a132c5021339d655 Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
Diffstat (limited to 'xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2')
-rw-r--r--xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j252
1 files changed, 52 insertions, 0 deletions
diff --git a/xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2 b/xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2
new file mode 100644
index 00000000..acd19d19
--- /dev/null
+++ b/xci/playbooks/roles/prepare-tests/templates/run-functest.sh.j2
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# Create directory to store functest logs
+mkdir -p /root/functest-results/
+
+# Dump the env file
+echo "------------------------------------------------------"
+echo "------------- functest environment file --------------"
+cat /root/env
+echo "------------------------------------------------------"
+
+# we need to ensure the necessary environment variables are sourced
+source /root/env
+
+{% if 'os-' in deploy_scenario %}
+{# stuff needed for OpenStack based scenarios #}
+# the needed images differ between the suites so avoid downloading unnecessary images
+echo "Downloading the images needed for functest-$FUNCTEST_SUITE_NAME"
+mkdir ~/images && cd ~/images
+if [[ "$FUNCTEST_SUITE_NAME" =~ "healthcheck" ]]; then
+ wget -q http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
+elif [[ "$FUNCTEST_SUITE_NAME" =~ "smoke" ]]; then
+ wget -q http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img \
+ http://testresults.opnfv.org/functest/shaker-image.qcow2 \
+ https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img
+else
+ echo "Unsupported test suite for functest"
+ exit 1
+fi
+echo "------------------------------------------------------"
+ls -al . && cd ~
+echo "------------------------------------------------------"
+
+# docker image to use will be different for healthcheck and smoke test
+DOCKER_IMAGE_NAME="ollivier/functest-${FUNCTEST_SUITE_NAME}"
+
+sudo docker run --env-file env \
+ -v $(pwd)/openrc:/home/opnfv/functest/conf/env_file \
+ -v $(pwd)/images:/home/opnfv/functest/images \
+ -v $(pwd)/functest-results:/home/opnfv/functest/results \
+ ${DOCKER_IMAGE_NAME}
+{% else %}
+{# stuff needed for Kubernetes based scenarios #}
+# docker image to use will be different for healthcheck and smoke test
+DOCKER_IMAGE_NAME="opnfv/functest-kubernetes-${FUNCTEST_SUITE_NAME}"
+
+sudo docker run --env-file env \
+ -v $(pwd)/k8s.creds:/home/opnfv/functest/conf/env_file \
+ -v $(pwd)/.kube/config:/root/.kube/config \
+ -v $(pwd)/functest-results:/home/opnfv/functest/results \
+ $DOCKER_IMAGE_NAME
+{% endif %}