You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Sometimes tests would fail because the port embedded postgres tries to useis already in use. This is because there's no way to tell postgres to usean ephemeral port. This change adds retries to starting embedded postgreswhen the port is not explicitly defined (e.g. tests), which should rid, orat least significantly reduce, these flakes.
logger.Warn(ctx,"failed to start embedded postgres",
2199
+
slog.F("attempt",attempt+1),
2200
+
slog.F("max_attempts",maxAttempts),
2201
+
slog.F("port",pgPort),
2202
+
slog.Error(startErr),
2203
+
)
2204
+
2205
+
// Since a retry is needed, we wipe the port stored here at the beginning of the loop.
2206
+
_=cfg.PostgresPort().Delete()
2179
2207
}
2180
-
returnconnectionURL,ep.Stop,nil
2208
+
2209
+
return"",nil,xerrors.Errorf("failed to start built-in PostgreSQL after %d attempts. Optionally, specify an external deployment with `--postgres-url`: %w",maxAttempts,startErr)