Skip to content

Commit 5c0b422

Browse files
committed
test: wait for final PostgreSQL startup
1 parent 5b085d3 commit 5c0b422

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎scripts/test-analytics-postgres.sh‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@ docker run --detach --rm \
1818
postgres:15.13-alpine3.20 >/dev/null
1919

2020
for _ in $(seq 1 60); do
21-
if docker exec "$container_name" pg_isready \
22-
-U humanly_analytics_test -d humanly_analytics_test >/dev/null 2>&1; then
21+
if docker exec "$container_name" sh -c \
22+
'test "$(cat /proc/1/comm)" = postgres && pg_isready -U humanly_analytics_test -d humanly_analytics_test' \
23+
>/dev/null 2>&1; then
2324
break
2425
fi
2526
sleep 1
2627
done
2728

28-
if ! docker exec "$container_name" pg_isready \
29-
-U humanly_analytics_test -d humanly_analytics_test >/dev/null 2>&1; then
29+
if ! docker exec "$container_name" sh -c \
30+
'test "$(cat /proc/1/comm)" = postgres && pg_isready -U humanly_analytics_test -d humanly_analytics_test' \
31+
>/dev/null 2>&1; then
3032
echo "Analytics PostgreSQL fixture did not become ready." >&2
3133
docker logs "$container_name" >&2 || true
3234
exit 1

0 commit comments

Comments
 (0)