aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ci/storperf/containers.sh
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-08-16 15:56:17 +0800
committerzhihui wu <wu.zhihui1@zte.com.cn>2017-08-18 16:01:39 +0800
commit70fc96ee9d7785a46de6847cd8bbb54a26bff3eb (patch)
treeda9fedcebcffc48a9ea7373deb228f1d6c02f835 /tests/ci/storperf/containers.sh
parent84ea7388ecb34034f7c6886886c46b00afc82c2c (diff)
refactor storperf scripts structure
- Run qtip and storperf containers by docker-compose - Cope the current patch changes into qtip container for verification - Run the script run_storage_qpi.sh for storperf test Change-Id: Ic140fb7531d270b9c62bcd72f5dbc13917534daf Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'tests/ci/storperf/containers.sh')
-rwxr-xr-xtests/ci/storperf/containers.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ci/storperf/containers.sh b/tests/ci/storperf/containers.sh
new file mode 100755
index 00000000..1c48a62e
--- /dev/null
+++ b/tests/ci/storperf/containers.sh
@@ -0,0 +1,49 @@
+#! /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 "Cleanup existing qtip and storperf containers"
+ docker-compose -f qtip-storperf-docker-compose.yaml down
+
+ for name in qtip storperf-master storperf-swaggerui storperf-httpfrontend storperf-reporting
+ do
+ container=$(docker ps -a | grep "opnfv/${name}:${DOCKER_TAG}" | awk '{print $1}')
+ if [[ ! -z "$container" ]]; then
+ echo "Removing any existing $name container"
+ docker rm -fv $container
+ fi
+
+ if [[ $(docker images opnfv/${name}:${DOCKER_TAG} | wc -l) -gt 1 ]]; then
+ echo "QTIP: Removing docker image opnfv/$name :$DOCKER_TAG..."
+ docker rmi -f opnfv/${name}:${DOCKER_TAG}
+ fi
+ done
+}
+
+
+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 "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
+
+ container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1)
+ if [[ -z "$container_id" ]]; then
+ echo "The container opnfv/qtip with ID=${container_id} has not been properly started. Exiting..."
+ exit 1
+ fi
+}