blob: c4bdae2de26ff6a3e4eba252151e177b16d9b274 [file] [log] [blame]
Yuli Shlosberge1209702017-09-24 17:43:28 +03001#!/bin/bash
2#
3# ============LICENSE_START=======================================================
4# ONAP CLAMP
5# ================================================================================
6# Copyright (C) 2017 AT&T Intellectual Property. All rights
7# reserved.
8# ================================================================================
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20# ============LICENSE_END============================================
21# ===================================================================
22# ECOMP is a trademark and service mark of AT&T Intellectual Property.
Yuli Shlosberge1209702017-09-24 17:43:28 +030023
24echo "This is ${WORKSPACE}/test/csit/scripts/vid/start_vid_containers.sh"
25
Yuli Shlosberge1209702017-09-24 17:43:28 +030026export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
Yuli Shlosberge1209702017-09-24 17:43:28 +030027
Mariusz Wagner5c18c8a2018-08-30 10:49:56 +020028cd ${WORKSPACE}/test/csit/tests/vid/resources
29docker-compose up -d --build
Yuli Shlosberge1209702017-09-24 17:43:28 +030030
31# WAIT 5 minutes maximum and test every 5 seconds if VID up using HealthCheck API
32
33TIME_OUT=1200
34INTERVAL=5
35TIME=0
36while [ "$TIME" -lt "$TIME_OUT" ]; do
37 response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/vid/healthCheck); echo $response
38
39 if [ "$response" == "200" ]; then
40 echo VID and its database well started in $TIME seconds
41 break;
42 fi
43
44 echo Sleep: $INTERVAL seconds before testing if VID is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
45 sleep $INTERVAL
46 TIME=$(($TIME+$INTERVAL))
47done
48
49if [ "$TIME" -ge "$TIME_OUT" ]; then
50 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests...
51fi