aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-08-24 17:07:50 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-08-26 02:24:07 +0000
commit9eb2005c087a6c064fd2880edd253028e3ea1513 (patch)
treef08671811e0c70e5c29173ea4ef4ea2aea37332b /tests
parent73f6ca735e00902f9b71a9110eb97c7b008d8e94 (diff)
Refactor storperf testing scripts into ansible role
Change-Id: Ifbfe0818a528dbd9b2c176acf39450ca480e931a Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'tests')
-rw-r--r--tests/ci/experimental.sh35
-rwxr-xr-xtests/ci/launch_containers_by_testsuite.sh6
-rwxr-xr-xtests/ci/run_storage_qpi.sh18
-rwxr-xr-xtests/ci/storperf/containers.sh7
-rw-r--r--tests/ci/storperf/default_job.json15
-rw-r--r--tests/ci/storperf/default_stack.json6
-rwxr-xr-xtests/ci/storperf/prepare.sh71
-rw-r--r--tests/ci/storperf/qtip-storperf-docker-compose.yaml26
-rwxr-xr-xtests/ci/storperf/start_job.sh110
-rw-r--r--tests/ci/storperf/storperf_requirements.txt5
-rwxr-xr-xtests/ci/verify_storage.sh35
11 files changed, 56 insertions, 278 deletions
diff --git a/tests/ci/experimental.sh b/tests/ci/experimental.sh
index 379e8602..3dd15d56 100644
--- a/tests/ci/experimental.sh
+++ b/tests/ci/experimental.sh
@@ -1,3 +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
+##############################################################################
-source tests/ci/verify_storage.sh
+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
index b55ba09c..08b80028 100755
--- a/tests/ci/launch_containers_by_testsuite.sh
+++ b/tests/ci/launch_containers_by_testsuite.sh
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+export ENV_FILE="${WORKSPACE}/env_file"
+
if [[ -e $ENV_FILE ]];then
rm $ENV_FILE
fi
@@ -51,8 +53,8 @@ if [[ "$TEST_SUITE" == 'compute' ]];then
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
+ 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
diff --git a/tests/ci/run_storage_qpi.sh b/tests/ci/run_storage_qpi.sh
index d4859d56..955d6751 100755
--- a/tests/ci/run_storage_qpi.sh
+++ b/tests/ci/run_storage_qpi.sh
@@ -7,8 +7,20 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-#TODO: These will be replaced by qtip cli
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-$script_dir/storperf/prepare.sh
-$script_dir/storperf/start_job.sh \ No newline at end of file
+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
index 26d582bf..62f8d4d5 100755
--- a/tests/ci/storperf/containers.sh
+++ b/tests/ci/storperf/containers.sh
@@ -19,11 +19,4 @@ 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
-
- echo "QTIP: Waiting for StorPerf to become active"
-
- while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000/api/v1.0/configurations) != "200" ]
- do
- sleep 1
- done
} \ No newline at end of file
diff --git a/tests/ci/storperf/default_job.json b/tests/ci/storperf/default_job.json
deleted file mode 100644
index 4e5e2dfd..00000000
--- a/tests/ci/storperf/default_job.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "block_sizes": "1024",
- "deadline": 30,
- "steady_state_samples": 2,
- "queue_depths": "1",
- "workload": "rw",
- "metadata": {
- "disk_type": "HDD",
- "scenario_name": "",
- "storage_node_count": 2,
- "version": "",
- "build_tag": "",
- "test_case": "snia_steady_state"
- }
-}
diff --git a/tests/ci/storperf/default_stack.json b/tests/ci/storperf/default_stack.json
deleted file mode 100644
index 79d8fc46..00000000
--- a/tests/ci/storperf/default_stack.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "agent_count": 2,
- "agent_image": "Ubuntu 16.04 x86_64",
- "public_network": "external",
- "volume_size": 2
-}
diff --git a/tests/ci/storperf/prepare.sh b/tests/ci/storperf/prepare.sh
deleted file mode 100755
index fe0708ad..00000000
--- a/tests/ci/storperf/prepare.sh
+++ /dev/null
@@ -1,71 +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
-##############################################################################
-
-if [[ -z $WORKSPACE ]];then
- WORKSPACE=`pwd`
-fi
-
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-pip install -r $script_dir/storperf_requirements.txt
-
-delete_storperf_stack()
-{
- echo "Checking for storperf stack"
- STACK_ID=`openstack stack list | grep StorPerfAgentGroup | awk '{print $2}'`
- if [[ ! -z $STACK_ID ]];then
- echo "Deleting any existing storperf stack"
- openstack stack delete --yes --wait StorPerfAgentGroup
- fi
-}
-
-load_ubuntu_image()
-{
- echo "Checking for Ubuntu 16.04 image in Glance"
- IMAGE=`openstack image list | grep "Ubuntu 16.04 x86_64" | awk '{print $2}'`
- if [[ -z "$IMAGE" ]];then
- cd $WORKSPACE
- if [[ ! -f ubuntu-16.04-server-cloudimg-amd64-disk1.img ]];then
- echo "Download Ubuntu 16.04 image"
- wget -q https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
- wget -q https://cloud-images.ubuntu.com/releases/16.04/release/MD5SUMS
- checksum=$(cat ./MD5SUMS |grep ubuntu-16.04-server-cloudimg-amd64-disk1.img | md5sum -c)
- if [[ $checksum =~ 'FAILED' ]];then
- echo "Check image md5sum failed. Exit!"
- exit 1
- fi
- fi
-
- echo "Creating openstack image Ubuntu 16.04"
- openstack image create "Ubuntu 16.04 x86_64" --disk-format qcow2 --public \
- --container-format bare --file $WORKSPACE/ubuntu-16.04-server-cloudimg-amd64-disk1.img
- else
- openstack image show "Ubuntu 16.04 x86_64"
- fi
-}
-
-create_storperf_flavor()
-{
- echo "Checking for StorPerf flavor"
- openstack flavor delete storperf
- FLAVOR=`openstack flavor list | grep "storperf" | awk '{print $2}'`
- if [[ -z "$FLAVOR" ]];then
- openstack flavor create storperf \
- --id auto \
- --ram 2048 \
- --disk 4 \
- --vcpus 2
- else
- openstack flavor show storperf
- fi
-}
-
-delete_storperf_stack
-load_ubuntu_image
-create_storperf_flavor
diff --git a/tests/ci/storperf/qtip-storperf-docker-compose.yaml b/tests/ci/storperf/qtip-storperf-docker-compose.yaml
index fc837139..9396a414 100644
--- a/tests/ci/storperf/qtip-storperf-docker-compose.yaml
+++ b/tests/ci/storperf/qtip-storperf-docker-compose.yaml
@@ -11,35 +11,15 @@ version: '2'
services:
storperf-master:
- container_name: "storperf-master"
+ container_name: storperf-master
image: opnfv/storperf-master:${DOCKER_TAG}
ports:
- - "8000:8000"
+ - 5000:5000
env_file: ${ENV_FILE}
- storperf-reporting:
- container_name: "storperf-reporting"
- image: opnfv/storperf-reporting:${DOCKER_TAG}
- ports:
- - "5080:5000"
-
- storperf-swaggerui:
- container_name: "storperf-swaggerui"
- image: "schickling/swagger-ui"
-
- storperf-httpfrontend:
- container_name: "storperf-httpfrontend"
- image: opnfv/storperf-httpfrontend:${DOCKER_TAG}
- ports:
- - "5000:5000"
- links:
- - storperf-master
- - storperf-reporting
- - storperf-swaggerui
-
qtip:
container_name: qtip
image: opnfv/qtip:${DOCKER_TAG}
env_file: ${ENV_FILE}
links:
- - storperf-httpfrontend \ No newline at end of file
+ - storperf-master
diff --git a/tests/ci/storperf/start_job.sh b/tests/ci/storperf/start_job.sh
deleted file mode 100755
index 15785036..00000000
--- a/tests/ci/storperf/start_job.sh
+++ /dev/null
@@ -1,110 +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
-##############################################################################
-
-usage(){
- echo "usage: $0 -s <stack_json_path> -j <job_json_path>" >&2
-}
-
-#Get options
-while getopts ":s:j:he" optchar; do
- case "${optchar}" in
- s) stack_json=${OPTARG} ;;
- j) job_json=${OPTARG} ;;
- h) usage
- exit 0
- ;;
- *) echo "Non-option argument: '-${OPTARG}'" >&2
- usage
- exit 2
- ;;
- esac
-done
-
-# See https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
-script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-stack_json=${stack_json:-"$script_dir/default_stack.json"}
-job_json=${job_json:-"$script_dir/default_job.json"}
-
-if [[ -z $WORKSPACE ]];then
- WORKSPACE=`pwd`
-fi
-
-nova_vm_mapping()
-{
- rm $WORKSPACE/nova_vm.json
- openstack server list --name storperf-agent -c ID -c Host --long -f json > $WORKSPACE/nova_vm.json
-
- echo ==========================================================================
- echo "Vms vs. Compute nodes"
- cat $WORKSPACE/nova_vm.json
- echo ==========================================================================
-}
-
-echo ==========================================================================
-echo "Start to create storperf stack"
-cat ${stack_json} 1>&2
-echo ==========================================================================
-
-curl -X POST --header 'Content-Type: application/json' \
- --header 'Accept: application/json' -d @${stack_json} \
- 'http://storperf-httpfrontend:5000/api/v1.0/configurations'
-
-nova_vm_mapping
-
-echo
-echo ==========================================================================
-echo "Start to run storperf test"
-cat ${job_json} 1>&2
-echo ==========================================================================
-
-JOB=$(curl -s -X POST --header 'Content-Type: application/json' \
- --header 'Accept: application/json' \
- -d @${job_json} 'http://storperf-httpfrontend:5000/api/v1.0/jobs' | \
- awk '/job_id/ {print $2}' | sed 's/"//g')
-
-echo "JOB ID: $JOB"
-if [[ -z "$JOB" ]]; then
- echo "Oops, JOB ID is empty!"
-else
- echo "checking job status..."
- curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=status" \
- -o $WORKSPACE/status.json
-
- cat $WORKSPACE/status.json
-
- JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2`
-
- while [ "$JOB_STATUS" != "Completed" ]
- do
- sleep 180
- mv $WORKSPACE/status.json $WORKSPACE/old-status.json
- curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=status" \
- -o $WORKSPACE/status.json
- JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2`
- diff $WORKSPACE/status.json $WORKSPACE/old-status.json >/dev/null
- if [ $? -eq 1 ]
- then
- cat $WORKSPACE/status.json
- fi
- done
-
- echo
- echo "Storperf test completed!"
-
- echo ==========================================================================
- echo Final report
- echo ==========================================================================
- curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=metadata" \
- -o $WORKSPACE/report.json
- cat $WORKSPACE/report.json
-fi
-
-echo "Deleting stack for cleanup"
-curl -s -X DELETE --header 'Accept: application/json' 'http://storperf-httpfrontend:5000/api/v1.0/configurations' \ No newline at end of file
diff --git a/tests/ci/storperf/storperf_requirements.txt b/tests/ci/storperf/storperf_requirements.txt
deleted file mode 100644
index 4a279ae5..00000000
--- a/tests/ci/storperf/storperf_requirements.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-functools32==3.2.3.post2
-pytz==2016.10
-osc_lib==1.3.0
-python-openstackclient==3.7.0
-python-heatclient==1.7.0
diff --git a/tests/ci/verify_storage.sh b/tests/ci/verify_storage.sh
deleted file mode 100755
index 32e94f9e..00000000
--- a/tests/ci/verify_storage.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/bash -x
-##############################################################################
-# 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
-##############################################################################
-
-TEST_SUITE=storage
-QTIP_REPO=/home/opnfv/repos/qtip
-
-export DOCKER_TAG=${DOCKER_TAG:-latest}
-export ENV_FILE=$WORKSPACE/env_file
-
-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 [[ -z "$container_id" ]]; then
- echo "QTIP: The container opnfv/qtip has not been properly started. Exiting..."
- exit 1
-else
- 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 -c "bash ${QTIP_REPO}/tests/ci/run_${TEST_SUITE}_qpi.sh"
- echo "QTIP: Verify ${TEST_SUITE} done!"
- exit 0
-fi
-
-