diff options
Diffstat (limited to 'tests/ci')
-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.sh | 19 | ||||
-rwxr-xr-x | tests/ci/launch_containers_by_testsuite.sh | 73 | ||||
-rwxr-xr-x | tests/ci/periodic.sh | 18 | ||||
-rw-r--r-- | tests/ci/run_compute_qpi.sh | 96 | ||||
-rwxr-xr-x | tests/ci/run_storage_qpi.sh | 26 | ||||
-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.sh | 28 |
8 files changed, 55 insertions, 234 deletions
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_compute_qpi.sh b/tests/ci/run_compute_qpi.sh deleted file mode 100644 index 7b3987fa..00000000 --- a/tests/ci/run_compute_qpi.sh +++ /dev/null @@ -1,96 +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 -############################################################################## -set -e -set -x - -usage(){ - echo "usage: $0 -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url>" >&2 -} - -verify_connectivity(){ - local ip=$1 - echo "Verifying connectivity to $ip..." - for i in $(seq 0 10); do - if ping -c 1 -W 1 $ip > /dev/null; then - echo "$ip is reachable!" - return 0 - fi - sleep 1 - done - error "Can not talk to $ip." -} - -#Getoptions -while getopts ":t:i:p:s:r:he" optchar; do - case "${optchar}" in - t) installer_type=${OPTARG} ;; - i) installer_ip=${OPTARG} ;; - p) pod_name=${OPTARG} ;; - s) scenario=${OPTARG} ;; - r) testapi_url=${OPTARG} ;; - h) usage - exit 0 - ;; - *) echo "Non-option argument: '-${OPTARG}'" >&2 - usage - exit 2 - ;; - esac -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:-$NODE_NAME} -scenario=${scenario:-$SCENARIO} -testapi_url=${testapi_url:-$TESTAPI_URL} - -# we currently support ericsson, intel, lf and zte labs -if [[ ! "$installer_type" =~ (fuel|apex) ]]; then - echo "Unsupported/unidentified installer $installer_type. Cannot continue!" - exit 1 -fi - -sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" - -verify_connectivity ${installer_ip} - -case "$installer_type" in - fuel) - ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa -q - sshpass -p r00tme ssh-copy-id $sshoptions ${installer_ip} - ;; -esac - -cd /home/opnfv - -qtip create --pod-name ${pod_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 - -# Remove ssh public key from installer -case "$installer_type" in - fuel) - publickey=$(sed -r 's/\//\\\//g' /root/.ssh/id_rsa.pub) - ssh $sshoptions root@${installer_ip} "sed -i '/$publickey/d' /root/.ssh/authorized_keys" - ;; -esac - -echo "Compute QPI done!" -exit 0
\ No newline at end of file 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 |