From 08073003a2083f5bcf72264a5632b122a603053c Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Tue, 2 Dec 2025 15:53:56 -0500 Subject: [PATCH] Better resilience if database doesn't start --- scripts/infra.sh | 5 ++++- scripts/perf-lab/main.yml | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/infra.sh b/scripts/infra.sh index 97e96fc..cfea574 100755 --- a/scripts/infra.sh +++ b/scripts/infra.sh @@ -78,7 +78,10 @@ start_postgres() { echo "PostgreSQL DB process: $pid" echo "Waiting for PostgreSQL to be ready..." - timeout 90s bash -c "until ${engine} exec $DB_CONTAINER_NAME pg_isready ; do sleep 5 ; done" + timeout 90s bash -c "until ${engine} exec $DB_CONTAINER_NAME pg_isready ; do sleep 5 ; done" || { + echo "Error: PostgreSQL failed to become ready" + exit 1 + } } stop_postgres() { diff --git a/scripts/perf-lab/main.yml b/scripts/perf-lab/main.yml index 5a3af8c..7ae232f 100644 --- a/scripts/perf-lab/main.yml +++ b/scripts/perf-lab/main.yml @@ -177,6 +177,10 @@ scripts: start-test-services: - sh: ${{PROJ_REPO_DIR}}/scripts/infra.sh -c 3 -p '${{config.resources.cpu.db}}' -s + watch: + - regex: "Error: PostgreSQL failed to become ready" + then: + abort: PostgreSQL failed to become ready stop-test-services: - sh: ${{PROJ_REPO_DIR}}/scripts/infra.sh -d