diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-10-10 19:50:44 +0000 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-10-10 20:03:58 +0000 |
commit | 6dc696f5d6adc6cdfa8dad053cd2def1ce56a025 (patch) | |
tree | 1aa6a7dcc3324f7ebb716603cc5b38b09e27d997 /test/csit/scripts | |
parent | e162e58e082206ad17b93befea082e16cccadd60 (diff) |
Reduce time spent waiting for spin up
The wait times are way too large. I've added similar script used in
the docker images to wait for the port to open.
Reduced overal time.
Fixed API call to get Configs. Should be: ".*" not "*.*"
Removed fake policy tests.
Issue-ID: POLICY-299
Change-Id: I4076ef8935dd128f1e240202083ce5567e70a67b
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'test/csit/scripts')
-rwxr-xr-x | test/csit/scripts/policy/script1.sh | 49 | ||||
-rwxr-xr-x | test/csit/scripts/policy/wait_for_port.sh | 18 |
2 files changed, 50 insertions, 17 deletions
diff --git a/test/csit/scripts/policy/script1.sh b/test/csit/scripts/policy/script1.sh index 473ef0dd8..30fb39586 100755 --- a/test/csit/scripts/policy/script1.sh +++ b/test/csit/scripts/policy/script1.sh @@ -94,47 +94,58 @@ export MTU=9126 docker-compose -f docker-compose-integration.yml up -d +if [ ! $? -eq 0 ]; then + echo "Docker compose failed" + exit 1 +fi + docker ps -docker inspect drools +#sleep 4m POLICY_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' drools` echo ${POLICY_IP} -sleep 3m - -docker inspect pdp - PDP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pdp` echo ${PDP_IP} -sleep 3m +PAP_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' pap` +echo ${PAP_IP} + +BRMS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' brmsgw` +echo ${BRMS_IP} + +NEXUS_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' nexus` +echo ${NEXUS_IP} -#for i in {1..60}; do -TIME_OUT=6000 +MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb` +echo ${MARIADB_IP} + +${DIR}/wait_for_port.sh ${MARIADB_IP} 3306 +${DIR}/wait_for_port.sh ${PAP_IP} 9091 +${DIR}/wait_for_port.sh ${PDP_IP} 8081 +${DIR}/wait_for_port.sh ${BRMS_IP} 9989 +${DIR}/wait_for_port.sh ${NEXUS_IP} 8081 +${DIR}/wait_for_port.sh ${POLICY_IP} 6969 + +TIME_OUT=600 INTERVAL=20 TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do curl -i --user healthcheck:zb!XztG34 -H "ContentType: application/json" -H "Accept: application/json" ${POLICY_IP}:6969/healthcheck && break - echo sleep $i - sleep $i -echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds + echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds sleep $INTERVAL TIME=$(($TIME+$INTERVAL)) done -#curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}' - -TIME_OUT=6000 +TIME_OUT=600 INTERVAL=20 TIME=0 while [ "$TIME" -lt "$TIME_OUT" ]; do - curl -v --silent -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "*.*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break - echo sleep $i - sleep $i + curl -i -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://${PDP_IP}:8081/pdp/api/getConfig && break echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds sleep $INTERVAL @@ -142,3 +153,7 @@ echo Sleep: $INTERVAL seconds before testing if Policy is up. Total wait time up done +# +# Add more sleep for everything to settle +# +sleep 3m diff --git a/test/csit/scripts/policy/wait_for_port.sh b/test/csit/scripts/policy/wait_for_port.sh new file mode 100755 index 000000000..10f08ded1 --- /dev/null +++ b/test/csit/scripts/policy/wait_for_port.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ $# -ne 2 ]]; then + echo "Usage: wait-for-port hostname port" >&2 + exit 1 +fi + +host=$1 +port=$2 + +echo "Waiting for $host port $port open" +until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do + sleep 1 +done + +echo "$host port $port is open" + +exit 0 |