Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/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 | |
| 29 | docker 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 2g --memory-swap=2g --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..." |
| 32 | echo "" |
| 33 | c=60 # seconds to wait |
| 34 | REWRITE="\e[45D\e[1A\e[K" |
| 35 | while [ $c -gt 0 ]; do |
| 36 | c=$((c-1)) |
| 37 | sleep 1 |
| 38 | echo -e "${REWRITE}$c" |
| 39 | done |
| 40 | echo -e "" |
| 41 | |
| 42 | |
| 43 | #monitor sanity process |
| 44 | |
| 45 | TIME_OUT=1200 |
| 46 | INTERVAL=20 |
| 47 | TIME=0 |
| 48 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 49 | |
| 50 | PID=`docker exec -i sdc-sanity ps -ef | grep java | awk '{print $2}'` |
| 51 | echo sanity PID is -- $PID |
| 52 | |
| 53 | if [ -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)) |
| 62 | done |
| 63 | |
| 64 | if [ "$TIME" -ge "$TIME_OUT" ] |
| 65 | then |
| 66 | echo TIME OUT: Sany was NOT completed in $TIME_OUT seconds... Could cause problems for tests... |
| 67 | fi |
| 68 | cp -rf ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport/* ${WORKSPACE}/archives/ |
| 69 | cp -rf ${WORKSPACE}/data/logs/ ${WORKSPACE}/archives/ |
| 70 | cp -rf ${WORKSPACE}/data/logs/sdc-sanity/target/*.xml ${WORKSPACE}/archives/ |
| 71 | |