test: wait for postgres readiness log twice (avoid connection-reset flake)

This commit is contained in:
2026-07-03 13:03:40 +10:00
parent 6ba78caf4c
commit a6830d6d9f
+5 -1
View File
@@ -33,7 +33,11 @@ func StartPostgres(ctx context.Context) (dsn string, terminate func(), err error
tcpostgres.WithUsername("artifacts"),
tcpostgres.WithPassword("artifacts123"),
testcontainers.WithWaitStrategy(
wait.ForListeningPort("5432/tcp").WithStartupTimeout(60*time.Second),
// Postgres opens the port, runs init scripts, then restarts, so wait
// for the readiness log to appear twice to avoid connection resets.
wait.ForLog("database system is ready to accept connections").
WithOccurrence(2).
WithStartupTimeout(60*time.Second),
),
)
if err != nil {