Add test suit for SDC helm chart validator
[integration/csit.git] / plans / sdc / sdc-helm-validator / setup.sh
1 #!/bin/bash
2
3 export SDC_HELM_VALIDATOR="sdc-helm-validator"
4 export SDC_HELM_VALIDATOR_IMAGE="nexus3.onap.org:10001/onap/org.onap.sdc.sdc-helm-validator:latest"
5
6 unset http_proxy
7 unset https_proxy
8
9 docker run -p 8080:8080 -d --name ${SDC_HELM_VALIDATOR} ${SDC_HELM_VALIDATOR_IMAGE}
10
11 # Wait container ready
12 HELM_VALIDATOR_IP='none'
13 for i in {1..5}
14 do
15   HELM_VALIDATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${SDC_HELM_VALIDATOR})
16   RESP_CODE=$(curl -s http://${HELM_VALIDATOR_IP}:8080/actuator/health | python2 -c 'import json,sys;obj=json.load(sys.stdin);print obj["status"]')
17    if [[ "$RESP_CODE" == "UP" ]]; then
18        echo 'SDC Helm Validator is ready'
19        break
20    fi
21
22   echo 'Waiting for SDC Helm Validator to start up...'
23   sleep 10s
24 done
25
26 echo HELM_VALIDATOR_IP=${HELM_VALIDATOR_IP}
27
28 # Pass any variables required by Robot test suites in ROBOT_VARIABLES
29 ROBOT_VARIABLES="-v VALIDATOR:${HELM_VALIDATOR_IP}:8080"