Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # ============LICENSE_START======================================================= |
| 4 | # Copyright (C) 2017 AT&T Intellectual Property. All rights |
| 5 | # reserved. |
| 6 | # ================================================================================ |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # ============LICENSE_END============================================ |
| 19 | # =================================================================== |
| 20 | # ECOMP is a trademark and service mark of AT&T Intellectual Property. |
| 21 | # |
| 22 | |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame] | 23 | echo "This is ${WORKSPACE}/scripts/modeling-toscaparsers-javatoscachecker/setup_containers.sh" |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 24 | |
| 25 | #start docker image |
| 26 | run-instance.sh nexus3.onap.org:10001/onap/modeling/javatoscachecker:latest modeling_javatoscachecker_1 "-p 8080:8080" |
| 27 | |
| 28 | #checker docker image is accesible: picked from clamp, some common script would be good |
| 29 | TIME_OUT=1200 |
| 30 | INTERVAL=5 |
| 31 | TIME=0 |
| 32 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 33 | response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/check_template/test_me); echo $response |
| 34 | |
| 35 | if [ "$response" == "404" ]; then |
| 36 | echo javatoscachecker service started in $TIME seconds |
| 37 | break; |
| 38 | fi |
| 39 | |
| 40 | echo Sleep: $INTERVAL seconds before testing if javatoscachecker service is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds |
| 41 | sleep $INTERVAL |
| 42 | TIME=$(($TIME+$INTERVAL)) |
| 43 | done |
| 44 | |
| 45 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
| 46 | echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests... |
| 47 | fi |
| 48 | |
| 49 | |