X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=plans%2Fso%2Fintegration-etsi-testing%2Fconfig%2Fwait-for-container.sh;h=e2849550db453817573d79c0071d25a1c88cb9ee;hb=0c2e97e23e761121bab7bbfae64873a60da0d25d;hp=598715d9985f6f88af06cf181d65f35eb0b365ff;hpb=50e7ec9e942e0aaa75867ed854c926639514e5e7;p=integration%2Fcsit.git diff --git a/plans/so/integration-etsi-testing/config/wait-for-container.sh b/plans/so/integration-etsi-testing/config/wait-for-container.sh index 598715d9..e2849550 100755 --- a/plans/so/integration-etsi-testing/config/wait-for-container.sh +++ b/plans/so/integration-etsi-testing/config/wait-for-container.sh @@ -118,16 +118,25 @@ process_arguments() exit 1 fi + result=$(docker inspect --format '{{.State.Running}}' $CONTAINER_NAME) + + if [ $result != "true" ] ; then + docker logs $CONTAINER_NAME + echo "$SCRIPT_NAME $(current_timestamp) ERROR: $CONTAINER_NAME container is not running" + exit 1 + fi + HOST_IP=$(docker inspect --format '{{ index .NetworkSettings.Networks "'$NETWORK_NAME'" "IPAddress"}}' $CONTAINER_NAME) - if [ $? -ne 0 ]; then + if [ $? -ne 0 ] || [ -z $HOST_IP ] ; then echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find HOST IP using network name: $NETWORK_NAME and container name: $CONTAINER_NAME" exit 1 fi - PORT=$(docker port $CONTAINER_NAME | cut -c1-$(docker port $CONTAINER_NAME | grep -aob '/' | grep -oE '[0-9]+')) +PORT=$((docker port $CONTAINER_NAME | cut -c1-$(docker port $CONTAINER_NAME | grep -aob '/' | grep -oE '[0-9]+' | sed 1q)) | sed 1q) - if [ $? -ne 0 ]; then + + if [ $? -ne 0 ] || [ -z $PORT ] ; then echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find PORT using project name: $PROJECT_NAME and container name: $CONTAINER_NAME" exit 1 fi @@ -135,6 +144,7 @@ process_arguments() $WAIT_FOR_SCRIPT -t "$TIME_OUT" -h "$HOST_IP" -p "$PORT" if [ $? -ne 0 ]; then + docker logs $CONTAINER_NAME echo "$SCRIPT_NAME $(current_timestamp) ERROR: wait-for.sh failed ..." exit 1 fi