diff options
author | Todd Malsbary <todd.malsbary@intel.com> | 2020-10-20 14:40:37 -0700 |
---|---|---|
committer | Todd Malsbary <todd.malsbary@intel.com> | 2020-10-30 16:32:45 -0700 |
commit | 6631ca7445b85b2c21ad3b9639a7b2cecc1fe480 (patch) | |
tree | 0cbd9083ad13adb3c5f7677b02872ab4b56a9eb9 /deployments | |
parent | 0c352ef0d74d4b51a0fce5123b34a6753e8ab6a4 (diff) |
Wait for service to be listening before running tests
Issue-ID: MULTICLOUD-1242
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Change-Id: I5aa45daf92ebfbee32d154dc17f7d2afd72bf255
Diffstat (limited to 'deployments')
-rwxr-xr-x | deployments/_functions.sh | 11 | ||||
-rwxr-xr-x | deployments/start.sh | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/deployments/_functions.sh b/deployments/_functions.sh index 47074433..c0feed0d 100755 --- a/deployments/_functions.sh +++ b/deployments/_functions.sh @@ -34,3 +34,14 @@ EOF function start_all { docker-compose up -d } + +function wait_for_service { + for try in {0..59}; do + echo "$(date +%H:%M:%S) - Waiting for service up" + sleep 1 + if $(curl http://localhost:9015/v1 &>/dev/null); then + return 0 + fi + done + exit 1 +} diff --git a/deployments/start.sh b/deployments/start.sh index e7ff1334..61af504c 100755 --- a/deployments/start.sh +++ b/deployments/start.sh @@ -21,3 +21,4 @@ stop_all start_mongo generate_k8sconfig start_all +wait_for_service |