blob: 6398827bcdf3c00afe8e02dbbac33bc096dc20b1 [file] [log] [blame]
eh552t9c0b4682017-08-21 11:10:11 +02001#!/bin/bash
2#
3# Copyright 2016-2017 Huawei Technologies Co., Ltd.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# Modifications copyright (c) 2017 AT&T Intellectual Property
18#
19# Place the scripts in run order:
20source ${WORKSPACE}/test/csit/scripts/clamp/script1.sh
21
22# Clone Clamp repo to get extra folder that has all needed to run docker with docker-compose to start DB and Clamp
23mkdir -p $WORKSPACE/archives/clamp-clone
24cd $WORKSPACE/archives/clamp-clone
25git clone --depth 1 http://gerrit.onap.org/r/clamp -b master
26cd clamp/extra/docker/clamp/
27
28# start Clamp and MariaDB containers with docker compose and configuration from clamp/extra/docker/clamp/docker-compose.yml
29docker-compose up -d
30
31# WAIT 5 minutes maximum and test every 5 seconds if Clamp up using HealthCheck API
32TIME_OUT=300
33INTERVAL=5
34TIME=0
35while [ "$TIME" -lt "$TIME_OUT" ]; do
36 response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/restservices/clds/v1/clds/healthcheck); echo $response
37
38 if [ "$response" == "200" ]; then
39 echo Clamp and its database well started in $TIME seconds
40 break;
41 fi
42
43 echo Sleep: $INTERVAL seconds before testing if Clamp is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
44 sleep $INTERVAL
45 TIME=$(($TIME+$INTERVAL))
46done
47
48if [ "$TIME" -ge "$TIME_OUT" ]; then
49 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests...
50fi
51
52# Pass any variables required by Robot test suites in ROBOT_VARIABLES
53#ROBOT_VARIABLES="-v TEST:${TEST}"
54