diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2019-04-29 18:32:21 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2019-04-29 18:32:21 -0500 |
commit | c9e7e93557b1fe7b244eacbf431e1131b39fc3e0 (patch) | |
tree | 1a5dbfbbeac024b5022bf70576a5ba5897d60b3d /packages/docker/src | |
parent | a205e21327b1e801746d9c1a067d48aa45a4ce70 (diff) |
Bound wait time for a component's port
This should prevent the 90 minutes timeouts
in CSIT tests.
Change-Id: Ia9491462f4c3b83564584eb9f85551570e3c6342
Issue-ID: POLICY-1712
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'packages/docker/src')
-rw-r--r-- | packages/docker/src/main/docker/wait-for-port.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/docker/src/main/docker/wait-for-port.sh b/packages/docker/src/main/docker/wait-for-port.sh index befebf208..15c6eb8b4 100644 --- a/packages/docker/src/main/docker/wait-for-port.sh +++ b/packages/docker/src/main/docker/wait-for-port.sh @@ -25,14 +25,17 @@ if [[ $# -ne 2 ]]; then exit 1 fi -host=$1 -port=$2 +export host=$1 +export port=$2 echo "Waiting for $host port $port open" -until nc -vz $host $port 2> /dev/null; do - sleep 1 -done +timeout 120 bash -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done' +rc=$? -echo "$host port $port is open" +if [[ $rc != 0 ]]; then + echo "$host port $port cannot be reached" + exit $rc +fi +echo "$host port $port is open" exit 0 |