test: wait for postgres readiness log twice (avoid connection-reset flake)
This commit is contained in:
@@ -33,7 +33,11 @@ func StartPostgres(ctx context.Context) (dsn string, terminate func(), err error
|
|||||||
tcpostgres.WithUsername("artifacts"),
|
tcpostgres.WithUsername("artifacts"),
|
||||||
tcpostgres.WithPassword("artifacts123"),
|
tcpostgres.WithPassword("artifacts123"),
|
||||||
testcontainers.WithWaitStrategy(
|
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 {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user