summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-09-15 05:48:16 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-15 05:48:16 +0000
commit35710f44ea46f07471ff8636fa4a2b8f8de56632 (patch)
tree58877a8a5b0a7b8d9b44d0ad9a0b6b28dc518e71
parentb2336bd1742797e0f38063f654646f115dd62e45 (diff)
parent2bf95e68a19fc3a7c1e3236a977b1d3b6db1c05c (diff)
Merge "Refactor CI scripts"
-rw-r--r--qtip/scripts/quickstart.sh (renamed from tests/ci/run_compute_qpi.sh)19
-rw-r--r--[-rwxr-xr-x]tests/ci/compute/docker-compose.yaml (renamed from tests/ci/storperf/containers.sh)23
-rwxr-xr-x[-rw-r--r--]tests/ci/experimental.sh19
-rwxr-xr-xtests/ci/launch_containers_by_testsuite.sh73
-rwxr-xr-xtests/ci/periodic.sh18
-rwxr-xr-xtests/ci/run_storage_qpi.sh26
-rw-r--r--tests/ci/storage/docker-compose.yaml (renamed from tests/ci/storperf/qtip-storperf-docker-compose.yaml)6
-rw-r--r--tests/ci/utils/start_services.sh28
8 files changed, 67 insertions, 145 deletions
diff --git a/tests/ci/run_compute_qpi.sh b/qtip/scripts/quickstart.sh
index 7b3987fa..58a12459 100644
--- a/tests/ci/run_compute_qpi.sh
+++ b/qtip/scripts/quickstart.sh
@@ -6,11 +6,14 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-set -e
+
+set -o nounset
+set -o errexit
+set -o pipefail
set -x
usage(){
- echo "usage: $0 -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url>" >&2
+ echo "usage: $0 -q <qtip_test_suite> -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url>" >&2
}
verify_connectivity(){
@@ -29,6 +32,7 @@ verify_connectivity(){
#Getoptions
while getopts ":t:i:p:s:r:he" optchar; do
case "${optchar}" in
+ q) test_suite=${OPTARG} ;;
t) installer_type=${OPTARG} ;;
i) installer_ip=${OPTARG} ;;
p) pod_name=${OPTARG} ;;
@@ -47,6 +51,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}
+test_suite=${test_suite:-$TEST_SUITE}
pod_name=${pod_name:-$NODE_NAME}
scenario=${scenario:-$SCENARIO}
testapi_url=${testapi_url:-$TESTAPI_URL}
@@ -70,10 +75,10 @@ esac
cd /home/opnfv
-qtip create --pod-name ${pod_name} --installer-type ${installer_type} \
---installer-host ${installer_ip} --scenario ${scenario} workspace
+qtip create --project-template ${test_suite} --pod-name ${pod_name} --installer-type ${installer_type} \
+--installer-host ${installer_ip} --scenario ${scenario} ${test_suite}
-cd /home/opnfv/workspace/
+cd ${test_suite}
qtip setup
eval `ssh-agent`
@@ -92,5 +97,5 @@ case "$installer_type" in
;;
esac
-echo "Compute QPI done!"
-exit 0 \ No newline at end of file
+echo "QTIP testing done!"
+exit 0
diff --git a/tests/ci/storperf/containers.sh b/tests/ci/compute/docker-compose.yaml
index 62f8d4d5..f21190e9 100755..100644
--- a/tests/ci/storperf/containers.sh
+++ b/tests/ci/compute/docker-compose.yaml
@@ -1,22 +1,17 @@
-#! /bin/bash
##############################################################################
-# Copyright (c) 2017 ZTE and others.
+# Copyright (c) 2017 Dell EMC, 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
##############################################################################
-clean_containers()
-{
- echo "QTIP: Cleanup existing qtip and storperf containers"
- docker-compose -f qtip-storperf-docker-compose.yaml down
-}
+version: '2'
+services:
-
-launch_containers()
-{
- echo "Launch new qtip and storperf containers"
- docker-compose -f qtip-storperf-docker-compose.yaml pull
- docker-compose -f qtip-storperf-docker-compose.yaml up -d
-} \ No newline at end of file
+ qtip:
+ container_name: compute_qtip
+ image: opnfv/qtip:${DOCKER_TAG}
+ env_file: ${ENV_FILE}
+ volumes: ${SSH_CREDENTIALS}:/root/.ssh
diff --git a/tests/ci/experimental.sh b/tests/ci/experimental.sh
index 3dd15d56..bb9694b7 100644..100755
--- a/tests/ci/experimental.sh
+++ b/tests/ci/experimental.sh
@@ -12,25 +12,26 @@ set -o pipefail
set -o nounset
set -x
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
export DEPLOY_SCENARIO='generic'
export DOCKER_TAG='latest'
export CI_DEBUG='false'
export TEST_SUITE='storage'
export TESTAPI_URL=''
+export SSH_CREDENTIALS='/root/.ssh'
export WORKSPACE=${WORKSPACE:-$(pwd)}
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-qtip_repo='/home/opnfv/repos/qtip'
+source ${script_dir}/utils/start_services.sh
-source $script_dir/launch_containers_by_testsuite.sh
+cd ${WORKSPACE}
-container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1)
+qtip_repo='/home/opnfv/repos/qtip'
+docker cp . ${TEST_SUITE}_qtip:${qtip_repo}
+docker exec ${TEST_SUITE}_qtip bash -c "cd ${qtip_repo} && pip install -U -e ."
-echo "QTIP: Copying current submit patch to the container ${container_id}"
-cd $WORKSPACE
-docker cp . ${container_id}:${qtip_repo}
-docker exec ${container_id} bash -c "cd ${qtip_repo} && pip install -U -e ."
-docker exec -t ${container_id} bash -x ${qtip_repo}/tests/ci/run_${TEST_SUITE}_qpi.sh
+docker exec -t ${TEST_SUITE}_qtip bash -x ${qtip_repo}/qtip/scripts/quickstart.sh
echo "QTIP: Verify ${TEST_SUITE} done!"
+
exit 0
diff --git a/tests/ci/launch_containers_by_testsuite.sh b/tests/ci/launch_containers_by_testsuite.sh
deleted file mode 100755
index 08b80028..00000000
--- a/tests/ci/launch_containers_by_testsuite.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#! /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
-##############################################################################
-
-export ENV_FILE="${WORKSPACE}/env_file"
-
-if [[ -e $ENV_FILE ]];then
- rm $ENV_FILE
-fi
-
-case $INSTALLER_TYPE in
- apex)
- INSTALLER_IP=`sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1`
- ;;
-esac
-
-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 "--------------------------------------------------------"
-
- 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
-
- container_name="qtip-${TEST_SUITE}"
- if [[ -n $(docker ps -a|grep ${container_name}) ]]; then
- echo "QTIP: cleaning existing container"
- docker stop ${container_name}
- docker rm ${container_name}
- fi
-
- cmd="sudo docker run -id --name ${container_name} ${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 )"
-
- curl https://git.opnfv.org/releng/plain/utils/fetch_os_creds.sh | bash -s -- \
- -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 "QTIP: Sorry, not support test suite $TEST_SUITE!"
- exit 1
-fi
diff --git a/tests/ci/periodic.sh b/tests/ci/periodic.sh
index 5bbebb93..a0054fec 100755
--- a/tests/ci/periodic.sh
+++ b/tests/ci/periodic.sh
@@ -9,22 +9,12 @@
set -e
set -x
-export DOCKER_TAG=${DOCKER_TAG:-latest}
-export ENV_FILE=$WORKSPACE/env_file
-QTIP_REPO=/home/opnfv/repos/qtip
-
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)
+source ${script_dir}/utils/start_services.sh
-if [[ -z "$container_id" ]]; then
- echo "QTIP: The container opnfv/qtip has not been properly started. Exiting..."
- exit 1
-else
- echo "QTIP: The container ID is: ${container_id}"
- docker exec -t ${container_id} bash -c "bash ${QTIP_REPO}/tests/ci/run_${TEST_SUITE}_qpi.sh"
-fi
+docker exec -t ${TEST_SUITE}_qtip bash -x ${qtip_repo}/qtip/scripts/quickstart.sh
echo "${TEST_SUITE} QPI done!"
-exit 0 \ No newline at end of file
+
+exit 0
diff --git a/tests/ci/run_storage_qpi.sh b/tests/ci/run_storage_qpi.sh
deleted file mode 100755
index 275bbb51..00000000
--- a/tests/ci/run_storage_qpi.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /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
-##############################################################################
-
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-cd /home/opnfv
-
-qtip create --project-template storage --pod-name ${NODE_NAME} --installer-type ${INSTALLER_TYPE} \
---installer-host ${INSTALLER_IP} --scenario ${SCENARIO} workspace
-
-cd /home/opnfv/workspace/
-
-qtip setup
-eval `ssh-agent`
-if [[ -z $testapi_url ]];then
- qtip run
-else
- qtip run --extra-vars "testapi_url=${TESTAPI_URL}"
-fi
-qtip teardown
diff --git a/tests/ci/storperf/qtip-storperf-docker-compose.yaml b/tests/ci/storage/docker-compose.yaml
index a1360200..7ffb0364 100644
--- a/tests/ci/storperf/qtip-storperf-docker-compose.yaml
+++ b/tests/ci/storage/docker-compose.yaml
@@ -11,15 +11,17 @@ version: '2'
services:
storperf:
- container_name: storperf
+ container_name: storage_storperf
image: opnfv/storperf:${DOCKER_TAG}
ports:
- 5000:5000
env_file: ${ENV_FILE}
qtip:
- container_name: qtip
+ container_name: storage_qtip
image: opnfv/qtip:${DOCKER_TAG}
env_file: ${ENV_FILE}
+ volumes:
+ - ${SSH_CREDENTIALS}:/root/.ssh
links:
- storperf
diff --git a/tests/ci/utils/start_services.sh b/tests/ci/utils/start_services.sh
new file mode 100644
index 00000000..78bc2970
--- /dev/null
+++ b/tests/ci/utils/start_services.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+# detect installer_ip
+case ${INSTALLER_TYPE} in
+ apex)
+ export INSTALLER_IP=$(sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1)
+ ;;
+esac
+
+export ENV_FILE="${ENV_FILE:-$(pwd)/env_file}"
+cat << EOF > $ENV_FILE
+INSTALLER_TYPE=${INSTALLER_TYPE}
+INSTALLER_IP=${INSTALLER_IP}
+TEST_SUITE=${TEST_SUITE}
+NODE_NAME=${NODE_NAME:-opnfv-pod}
+SCENARIO=${DEPLOY_SCENARIO:-generic}
+TESTAPI_URL=${TESTAPI_URL:-}
+EOF
+
+TMPFILE=`mktemp /tmp/qtip.XXXXXX` || exit 1
+curl https://git.opnfv.org/releng/plain/utils/fetch_os_creds.sh | bash -s -- \
+ -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} -d ${TMPFILE}
+grep "export" ${TMPFILE} | sed "s/export //" >> $ENV_FILE
+# eliminate warning message "Invalid -W option ignored: invalid action: '"ignore'"
+sed -i '/^PYTHONWARNINGS=/d' $ENV_FILE
+
+docker-compose -f $script_dir/${TEST_SUITE}/docker-compose.yaml pull
+docker-compose -f $script_dir/${TEST_SUITE}/docker-compose.yaml up -d