Skip to content

Commit 792993e

Browse files
committed
Add retry logic for service startup in test script
Signed-off-by: Ankur Singh <[email protected]>
1 parent ff686de commit 792993e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/guardrails/test_guardrails_polite_guard.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ function start_service() {
2828
cd comps/guardrails/deployment/docker_compose/
2929
docker compose up ${service_name} -d
3030
sleep 15
31+
max_retries=3
32+
retries=0
3133
until docker logs ${service_name} 2>&1 | grep -q "Application startup complete"; do
32-
echo "Waiting for application startup to complete..."
34+
if [ $retries -ge $max_retries ]; then
35+
echo "Application failed to start after $max_retries attempts."
36+
exit 1
37+
fi
38+
echo "Waiting for application startup to complete... (Attempt $((retries + 1))/$max_retries)"
39+
retries=$((retries + 1))
3340
sleep 2 # Wait for 2 seconds before checking again
3441
done
3542
echo "Microservice started"

0 commit comments

Comments
 (0)