diff options
author | Torsten Grote <t@grobox.de> | 2020-05-08 11:53:17 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-05-08 11:53:58 -0300 |
commit | 1cf48054c47d9562876b5f021dc398b050b959fd (patch) | |
tree | 237a7380d55eb9532bf069f2179098d6f40c8e92 /integrationtests/common.sh | |
parent | 8056c7fb62ceb8de3171d13fd48d44bbdc43645c (diff) |
Add test for retries
Diffstat (limited to 'integrationtests/common.sh')
-rw-r--r-- | integrationtests/common.sh | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/integrationtests/common.sh b/integrationtests/common.sh index 8036b825b..57dc1a863 100644 --- a/integrationtests/common.sh +++ b/integrationtests/common.sh @@ -109,8 +109,7 @@ function wait_for_services() { echo -n "." sleep 0.2 OK=0 - # bank - wget http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || continue + wget "$BANK_URL" -o /dev/null -O /dev/null >/dev/null || continue OK=1 break done @@ -119,12 +118,9 @@ function wait_for_services() { echo -n "." sleep 0.1 OK=0 - # exchange - wget http://localhost:8081/ -o /dev/null -O /dev/null >/dev/null || continue - # merchant - wget http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || continue - # Auditor - wget http://localhost:8083/ -o /dev/null -O /dev/null >/dev/null || continue + wget "$EXCHANGE_URL" -o /dev/null -O /dev/null >/dev/null || continue + wget "$MERCHANT_URL" -o /dev/null -O /dev/null >/dev/null || continue + wget "$AUDITOR_URL" -o /dev/null -O /dev/null >/dev/null || continue OK=1 break done @@ -142,6 +138,17 @@ function normal_start_and_wait() { wait_for_services } +# provide the service URL as first parameter +function wait_for_service() { + for _ in $(seq 1 50); do + echo -n "." + sleep 0.1 + wget "$1" -o /dev/null -O /dev/null >/dev/null || continue + echo " DONE" + break + done +} + function shutdown_services() { echo "Shutting down services" jobs -p | xargs --no-run-if-empty kill || true @@ -164,6 +171,11 @@ function exit_skip() { } function exit_error() { - echo "Error: $1" + echo "\033[0;31mError: $1\033[0m" exit 1 } + +function exit_success() { + echo -e "\033[0;32mSUCCESS \o/\033[0m" + exit 0 +} |