diff options
Diffstat (limited to 'tests/ci')
-rw-r--r-- | tests/ci/experimental.sh | 36 | ||||
-rwxr-xr-x | tests/ci/launch_containers_by_testsuite.sh | 73 | ||||
-rwxr-xr-x | tests/ci/periodic.sh | 73 | ||||
-rw-r--r-- | tests/ci/run_compute_qpi.sh | 3 | ||||
-rwxr-xr-x | tests/ci/run_storage_qpi.sh | 26 | ||||
-rwxr-xr-x | tests/ci/storperf/containers.sh | 22 | ||||
-rw-r--r-- | tests/ci/storperf/qtip-storperf-docker-compose.yaml | 25 |
7 files changed, 197 insertions, 61 deletions
diff --git a/tests/ci/experimental.sh b/tests/ci/experimental.sh new file mode 100644 index 00000000..3dd15d56 --- /dev/null +++ b/tests/ci/experimental.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env 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 +############################################################################## + +set -o errexit +set -o pipefail +set -o nounset +set -x + +export DEPLOY_SCENARIO='generic' +export DOCKER_TAG='latest' +export CI_DEBUG='false' +export TEST_SUITE='storage' +export TESTAPI_URL='' + +export WORKSPACE=${WORKSPACE:-$(pwd)} + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +qtip_repo='/home/opnfv/repos/qtip' + +source $script_dir/launch_containers_by_testsuite.sh + +container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1) + +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 +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 new file mode 100755 index 00000000..08b80028 --- /dev/null +++ b/tests/ci/launch_containers_by_testsuite.sh @@ -0,0 +1,73 @@ +#! /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 4235cdee..5bbebb93 100755 --- a/tests/ci/periodic.sh +++ b/tests/ci/periodic.sh @@ -7,71 +7,24 @@ # 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) - INSTALLER_IP=`sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1` - ;; -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" -docker_volume="-v /var/run/docker.sock:/var/run/docker.sock" - -cmd="docker run -id ${envs} ${docker_volume} 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..." - exit 1 -fi -echo "The container ID is: ${container_id}" -QTIP_REPO=/home/opnfv/repos/qtip - -if [[ "$INSTALLER_TYPE" == "apex" ]];then - if [ -f /root/.ssh/id_rsa ]; then - sudo chmod 600 /root/.ssh/id_rsa - sudo docker cp /root/.ssh/id_rsa ${container_id}:/root/.ssh/ - fi +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 -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} diff --git a/tests/ci/run_storage_qpi.sh b/tests/ci/run_storage_qpi.sh new file mode 100755 index 00000000..955d6751 --- /dev/null +++ b/tests/ci/run_storage_qpi.sh @@ -0,0 +1,26 @@ +#! /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 -vv +else + qtip run --extra-vars "testapi_url=${TESTAPI_URL}" +fi +qtip teardown diff --git a/tests/ci/storperf/containers.sh b/tests/ci/storperf/containers.sh new file mode 100755 index 00000000..62f8d4d5 --- /dev/null +++ b/tests/ci/storperf/containers.sh @@ -0,0 +1,22 @@ +#! /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 +############################################################################## + +clean_containers() +{ + echo "QTIP: Cleanup existing qtip and storperf containers" + docker-compose -f qtip-storperf-docker-compose.yaml down +} + + +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 diff --git a/tests/ci/storperf/qtip-storperf-docker-compose.yaml b/tests/ci/storperf/qtip-storperf-docker-compose.yaml new file mode 100644 index 00000000..a1360200 --- /dev/null +++ b/tests/ci/storperf/qtip-storperf-docker-compose.yaml @@ -0,0 +1,25 @@ +############################################################################## +# 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 +############################################################################## + +version: '2' +services: + + storperf: + container_name: storperf + image: opnfv/storperf:${DOCKER_TAG} + ports: + - 5000:5000 + env_file: ${ENV_FILE} + + qtip: + container_name: qtip + image: opnfv/qtip:${DOCKER_TAG} + env_file: ${ENV_FILE} + links: + - storperf |