From 04cb9969965b5948a1a245e6d70dde381b18bd18 Mon Sep 17 00:00:00 2001 From: mbeierl Date: Thu, 24 Aug 2017 16:45:31 -0400 Subject: Expaning the Verify Scope Adds a new verify job that does docker-compose build and up, and checks for HTTP responses from each of the endpoints. Change-Id: Idcb74c8b8337a74a2b624f93ea6b34707d7e5516 JIRA: STORPERF-199 Signed-off-by: mbeierl --- ci/merge.sh | 3 +- ci/verify-build.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100755 ci/verify-build.sh (limited to 'ci') diff --git a/ci/merge.sh b/ci/merge.sh index 80ffdb6..333a05c 100755 --- a/ci/merge.sh +++ b/ci/merge.sh @@ -8,5 +8,4 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# Just run the verify again for now -`dirname $0`/verify.sh \ No newline at end of file +exit 0 diff --git a/ci/verify-build.sh b/ci/verify-build.sh new file mode 100755 index 0000000..dfa999c --- /dev/null +++ b/ci/verify-build.sh @@ -0,0 +1,80 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2017 Dell EMC 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 +############################################################################## + +cd `dirname $0` +ci=`pwd` + +cd ${ci}/../docker + +export ENV_FILE=${ci}/job/admin.rc +export CARBON_DIR=${ci}/job/carbon/ + +touch ${ENV_FILE} +mkdir -p ${CARBON_DIR} + +if [ -z $ARCH ] +then + ARCH=x86_64 +fi + +export ARCH + +docker-compose -f local-docker-compose.yaml down +docker-compose -f local-docker-compose.yaml build +docker-compose -f local-docker-compose.yaml up -d + +function check_for_life() { + NAME=$1 + URI=$2 + + echo "Waiting for ${NAME} to become active" + ATTEMPTS=10 + + while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000${URI}) != "200" ] + do + ATTEMPTS=$((ATTEMPTS - 1)) + if [ ${ATTEMPTS} -le 1 ] + then + echo "Failed to get a start up of ${NAME}" + return 1 + fi + sleep 2 + done +} + +FAILURES=0 + +check_for_life storperf-httpfrontend "/" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-master "/api/v1.0/configurations" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-reporting "/reporting/" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-swagger "/swagger/?url=http://127.0.0.1:5000/api/spec.json" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-graphite "/graphite/" +FAILURES=$((FAILURES + $?)) + + +for container in master graphite httpfrontend swaggerui reporting +do + echo "=====================================" + echo "Log for storperf-${container}" + docker logs storperf-${container} +done +echo "=====================================" + +docker-compose -f local-docker-compose.yaml down + +exit ${FAILURES} -- cgit 1.2.3-korg