blob: 33dbf67aa85f8f4ecb95987d53c064fd391fbb27 [file] [log] [blame]
Yuli Shlosberg82330072017-09-27 22:42:51 +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.
23#
24
25
26
27#start Sanity docker
28
29docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 512m --memory-swap=512m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE}
30
31#echo "please wait while Sanity Docker is starting..."
32echo ""
33c=60 # seconds to wait
34REWRITE="\e[45D\e[1A\e[K"
35while [ $c -gt 0 ]; do
36 c=$((c-1))
37 sleep 1
38 echo -e "${REWRITE}$c"
39done
40echo -e ""
41
42
43#monitor sanity process
44
45TIME_OUT=1200
46INTERVAL=20
47TIME=0
48while [ "$TIME" -lt "$TIME_OUT" ]; do
49
50PID=`docker exec -it sdc-sanity ps -ef | grep java | awk '{print $2}'`
51echo sanity PID is -- $PID
52
53if [ -z "$PID" ]
54 then
55 echo SDC sanity finished in $TIME seconds
56 break
57 fi
58
59 echo Sleep: $INTERVAL seconds before testing if SDC sanity completed. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
60 sleep $INTERVAL
61 TIME=$(($TIME+$INTERVAL))
62done
63
64if [ "$TIME" -ge "$TIME_OUT" ]
65 then
66 echo TIME OUT: Sany was NOT completed in $TIME_OUT seconds... Could cause problems for tests...
67fi
68cp -rf ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport/* ${WORKSPACE}/archives/