From 7b3f1144f787b0cb8e22e1c46392800d0341baf2 Mon Sep 17 00:00:00 2001 From: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> Date: Fri, 31 Jul 2026 00:46:27 +0800 Subject: [PATCH] fix(ci): wait for final PostgreSQL process Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> --- .../tests/identity-binding-v2-postgres-test.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/tests/identity-binding-v2-postgres-test.sh b/scripts/tests/identity-binding-v2-postgres-test.sh index e6ffd017..4735b42d 100755 --- a/scripts/tests/identity-binding-v2-postgres-test.sh +++ b/scripts/tests/identity-binding-v2-postgres-test.sh @@ -46,17 +46,25 @@ docker run -d \ postgres:16-alpine >/dev/null log "waiting for PostgreSQL readiness" +postgres_ready="false" for _ in $(seq 1 60); do - if docker exec "${POSTGRES_CONTAINER}" \ + pid_one_comm="$( + docker exec "${POSTGRES_CONTAINER}" \ + cat /proc/1/comm 2>/dev/null || true + )" + if [[ "${pid_one_comm}" == "postgres" ]] \ + && docker exec "${POSTGRES_CONTAINER}" \ pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" \ >/dev/null 2>&1; then + postgres_ready="true" break fi sleep 1 done -docker exec "${POSTGRES_CONTAINER}" \ - pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" \ - >/dev/null +if [[ "${postgres_ready}" != "true" ]]; then + log "PostgreSQL did not become ready after entrypoint initialization" + exit 1 +fi log "PostgreSQL is ready" run_test() {