aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-08-23 01:07:31 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-23 01:07:31 +0000
commita41a1dc52e79a2f37d0572a5ed251492f414dc57 (patch)
treeba2c18b88eea7fb3c0446cb457b51af676aab92b /tests
parentc6d9fcbffa0146ef968be0594b4c1afe98c3ee57 (diff)
parent582f77439f8ec2ff247c0d3843a0ecf6da2efa70 (diff)
Merge "Setup CI job for storage benchmarking on apex"
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ci/launch_containers_by_testsuite.sh70
-rwxr-xr-xtests/ci/periodic.sh60
-rw-r--r--tests/ci/run_compute_qpi.sh3
3 files changed, 85 insertions, 48 deletions
diff --git a/tests/ci/launch_containers_by_testsuite.sh b/tests/ci/launch_containers_by_testsuite.sh
new file mode 100755
index 00000000..ff94a02d
--- /dev/null
+++ b/tests/ci/launch_containers_by_testsuite.sh
@@ -0,0 +1,70 @@
+#! /bin/bash
+##############################################################################
+# Copyright (c) 2017 ZTE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+if [[ -e $ENV_FILE ]];then
+ rm $ENV_FILE
+fi
+
+echo "INSTALLER_TYPE=$INSTALLER_TYPE" >> $ENV_FILE
+echo "INSTALLER_IP=$INSTALLER_IP" >> $ENV_FILE
+echo "NODE_NAME=$NODE_NAME" >> $ENV_FILE
+echo "SCENARIO=$DEPLOY_SCENARIO" >> $ENV_FILE
+echo "TESTAPI_URL=$TESTAPI_URL" >> $ENV_FILE
+
+if [[ "$TEST_SUITE" == 'compute' ]];then
+
+ echo "--------------------------------------------------------"
+ cat $ENV_FILE
+ echo "--------------------------------------------------------"
+
+ if [[ ! -z $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG") ]]; then
+ echo "Removing existing opnfv/qtip containers..."
+ container_id=$(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG" | awk '{print $1}')
+ docker stop $container_id
+ docker rm $container_id
+ fi
+
+ if [[ $(docker images opnfv/qtip:${DOCKER_TAG} | wc -l) -gt 1 ]]; then
+ echo "Removing docker image opnfv/qtip:$DOCKER_TAG..."
+ docker rmi opnfv/qtip:$DOCKER_TAG
+ fi
+
+ echo "Qtip: Pulling docker image: opnfv/qtip:${DOCKER_TAG}"
+ docker pull opnfv/qtip:$DOCKER_TAG >/dev/null
+
+ envs="--env-file $ENV_FILE"
+ vols=""
+ if [[ "$INSTALLER_TYPE" == "apex" ]];then vols="-v /root/.ssh:/root/.ssh"
+ fi
+
+ cmd="sudo docker run -id ${envs} ${vols} opnfv/qtip:${DOCKER_TAG} /bin/bash"
+ echo "Qtip: Running docker command: ${cmd}"
+ ${cmd}
+
+elif [[ "$TEST_SUITE" == 'storage' ]];then
+ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+ git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng
+ $WORKSPACE/releng/utils/fetch_os_creds.sh -i $INSTALLER_TYPE -a $INSTALLER_IP -d $WORKSPACE/openrc
+
+ grep "export" $WORKSPACE/openrc | sed "s/export //" >> $ENV_FILE
+ echo "DOCKER_TAG=$DOCKER_TAG" >> $ENV_FILE
+
+ echo "--------------------ENV_FILE----------------------------"
+ cat $ENV_FILE
+ echo "--------------------------------------------------------"
+
+ source $script_dir/storperf/containers.sh
+ cd $script_dir/storperf
+ clean_containers
+ launch_containers
+else
+ echo "Sorry, not support test suite $TEST_SUITE!"
+ exit 1
+fi
diff --git a/tests/ci/periodic.sh b/tests/ci/periodic.sh
index 3f5fe784..f208cdc6 100755
--- a/tests/ci/periodic.sh
+++ b/tests/ci/periodic.sh
@@ -7,7 +7,11 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -e
+set -x
+export DOCKER_TAG=${DOCKER_TAG:-latest}
+export ENV_FILE=$WORKSPACE/env_file
+QTIP_REPO=/home/opnfv/repos/qtip
case $INSTALLER_TYPE in
apex)
@@ -15,56 +19,18 @@ case $INSTALLER_TYPE in
;;
esac
-cat << EOF > $WORKSPACE/env_file
-INSTALLER_TYPE=$INSTALLER_TYPE
-INSTALLER_IP=$INSTALLER_IP
-POD_NAME=$NODE_NAME
-SCENARIO=$DEPLOY_SCENARIO
-TESTAPI_URL=$TESTAPI_URL
-EOF
-
-echo "--------------------------------------------------------"
-cat $WORKSPACE/env_file
-echo "--------------------------------------------------------"
-
-# Remove previous running containers if exist
-if [[ ! -z $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG") ]]; then
- echo "Removing existing opnfv/qtip containers..."
- # workaround: sometimes it throws an error when stopping qtip container.
- # To make sure ci job unblocked, remove qtip container by force without stopping it.
- docker rm -f $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG" | awk '{print $1}')
-fi
-
-# Remove existing images if exist
-if [[ $(docker images opnfv/qtip:${DOCKER_TAG} | wc -l) -gt 1 ]]; then
- echo "Removing docker image opnfv/qtip:$DOCKER_TAG..."
- docker rmi -f opnfv/qtip:$DOCKER_TAG
-fi
-
-echo "Qtip: Pulling docker image: opnfv/qtip:${DOCKER_TAG}"
-docker pull opnfv/qtip:$DOCKER_TAG >/dev/null
-
-envs="--env-file $WORKSPACE/env_file"
-vols="-v /root/.ssh:/root/.ssh"
-
-cmd="sudo docker run -id ${envs} ${vols} opnfv/qtip:${DOCKER_TAG} /bin/bash"
-echo "Qtip: Running docker command: ${cmd}"
-${cmd}
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $script_dir/launch_containers_by_testsuite.sh
container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1)
-if [ $(docker ps | grep 'opnfv/qtip' | wc -l) == 0 ]; then
- echo "The container opnfv/qtip with ID=${container_id} has not been properly started. Exiting..."
+
+if [[ -z "$container_id" ]]; then
+ echo "The container opnfv/qtip has not been properly started. Exiting..."
exit 1
+else
+ echo "The container ID is: ${container_id}"
+ docker exec -t ${container_id} bash -c "bash ${QTIP_REPO}/tests/ci/run_${TEST_SUITE}_qpi.sh"
fi
-echo "The container ID is: ${container_id}"
-QTIP_REPO=/home/opnfv/repos/qtip
-
-case $TEST_SUITE in
- compute)
- docker exec -t ${container_id} bash -c "bash ${QTIP_REPO}/tests/ci/run_compute_qpi.sh"
- ;;
-esac
-
-echo "Qtip done!"
+echo "${TEST_SUITE} QPI done!"
exit 0 \ No newline at end of file
diff --git a/tests/ci/run_compute_qpi.sh b/tests/ci/run_compute_qpi.sh
index 09762b15..7b3987fa 100644
--- a/tests/ci/run_compute_qpi.sh
+++ b/tests/ci/run_compute_qpi.sh
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -e
+set -x
usage(){
echo "usage: $0 -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url>" >&2
@@ -46,7 +47,7 @@ done
#set vars from env if not provided by user as options
installer_type=${installer_type:-$INSTALLER_TYPE}
installer_ip=${installer_ip:-$INSTALLER_IP}
-pod_name=${pod_name:-$POD_NAME}
+pod_name=${pod_name:-$NODE_NAME}
scenario=${scenario:-$SCENARIO}
testapi_url=${testapi_url:-$TESTAPI_URL}