8000 chore: fail flake check if pg_isready fails · hscmgroup/postgres@1ffadf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ffadf4

Browse files
samrosedarora
authored andcommitted
chore: fail flake check if pg_isready fails
1 parent 97552e8 commit 1ffadf4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

flake.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,21 @@
398398
echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf
399399
#postgres -D "$PGDATA" -k "$TMPDIR" -h localhost -p 5432 >$TMPDIR/logfile/postgresql.log 2>&1 &
400400
pg_ctl -D "$PGDATA" -l $TMPDIR/logfile/postgresql.log -o "-k $TMPDIR -p 5432" start
401+
for i in {1..60}; do
402+
if pg_isready -h localhost -p 5432; then
403+
echo "PostgreSQL is ready"
404+
break
405+
fi
406+
sleep 1
407+
if [ $i -eq 60 ]; then
408+
echo "PostgreSQL is not ready after 60 seconds"
409+
echo "PostgreSQL status:"
410+
pg_ctl -D "$PGDATA" status
411+
echo "PostgreSQL log content:"
412+
cat $TMPDIR/logfile/postgresql.log
413+
exit 1
414+
fi
415+
done
401416
createdb -p 5432 -h localhost testing
402417
psql -p 5432 -h localhost -d testing -Xaf ${./nix/tests/prime.sql}
403418
pg_prove -p 5432 -h localhost -d testing ${sqlTests}/*.sql

0 commit comments

Comments
 (0)
0