From 1c0bf7c14ba1af4d8d8be2ab469acba43ef86116 Mon Sep 17 00:00:00 2001 From: Gabriele Gerbino Date: Fri, 5 Jan 2024 14:29:40 +0100 Subject: [PATCH] ci: fix kong setup verification --- .ci/setup_kong_ee.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.ci/setup_kong_ee.sh b/.ci/setup_kong_ee.sh index ed76b30..245bf71 100755 --- a/.ci/setup_kong_ee.sh +++ b/.ci/setup_kong_ee.sh @@ -71,11 +71,19 @@ GATEWAY_CONTAINER_NAME=kong # create docker network docker network create $NETWORK_NAME -waitContainer() { +waitPostGres() { for try in {1..100}; do - echo "waiting for $1.." - nc localhost $2 && break; - sleep $3 + echo "waiting for PostgreSQL" + nc localhost 5432 && break; + sleep 0.2 + done +} + +waitKong() { + for try in {1..100}; do + echo "waiting for Kong" + docker exec --user root kong kong health && break; + sleep 0.2 done } @@ -88,7 +96,7 @@ docker run --rm -d --name $PG_CONTAINER_NAME \ -e "POSTGRES_PASSWORD=$KONG_DB_PASSWORD" \ postgres:9.6 -waitContainer "PostgreSQL" 5432 0.2 +waitPostGres # Prepare the Kong database docker run --rm --network=$NETWORK_NAME \ @@ -126,4 +134,4 @@ docker run -d --name $GATEWAY_CONTAINER_NAME \ -p 8004:8004 \ $KONG_IMAGE -waitContainer "Kong" 8001 0.2 +waitKong