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
{{ message }}
Repository navigation
Commit 0dc990b
Browse filesBrowse the repository at this point in the historyBrowse files
test(integration): widen the Postgres readiness window, which was the flake
Three red gates in one session, three different tests across two ports, one
signature: "postgres container '...' did not become ready within 30s". Python
query scenarios, Java query scenarios, Python jsonb. Each passed on a re-run with
nothing else going.
It is not a product failure and it never reaches test logic -- it fires while the
container is still booting. But a gate that goes red for a reason indistinguishable
from a real failure is a red issue in its own right: the only way to tell the two
apart is to re-run and see, which is exactly the habit that lets a genuine failure
get waved through as "probably the flake".
The cause is arithmetic rather than mysterious. A FULL local-CI run has several
ports spinning their own Postgres concurrently; 30s is a guess that holds when one
port runs alone and does not when four do. All four ports hardcoded the same 30 --
TS, Java, Kotlin and Python each with their own copy of the same loop and the same
message.
Now 120s in all four, overridable with MO_PG_READY_TIMEOUT_S, and the failure
message reports the window actually used instead of a hardcoded "30s" that could
drift from the constant beside it.
Raising the bound costs nothing in the normal case: every one of these polls at
250ms and returns the instant the container answers, so a fast container is
unaffected. The only thing that changes is how long a genuinely broken container
takes to give up -- and for a CI gate, 90 extra seconds once is cheaper than a
false red that has to be re-run to interpret.
Compiles: java + kotlin integration modules (both sit outside the reactor, so
they are built directly), TS workspace typecheck clean, python parses.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: server/java/integration-tests-kotlin/src/test/kotlin/com/metaobjects/integration/kotlin/PostgresContainer.kt
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,12 @@ class PostgresContainer : AutoCloseable {
100
100
}
101
101
102
102
privatefunwaitForReady() {
103
-
val deadline =System.currentTimeMillis() +30_000
103
+
// READINESS WINDOW. 30s was too tight: under a FULL local-CI run several ports
104
+
// spin their own Postgres concurrently, and a container that is merely slow to
105
+
// boot produces a red gate indistinguishable from a real failure -- it fires
106
+
// BEFORE any test logic. Raising the bound costs nothing when the container is
107
+
// ready quickly (this polls every 250ms and returns immediately).
108
+
val deadline =System.currentTimeMillis() + (READY_TIMEOUT_S*1000L)
104
109
while (System.currentTimeMillis() < deadline) {
105
110
try {
106
111
val p =ProcessBuilder("docker", "exec", name, "pg_isready", "-U", PG_USER)
@@ -117,7 +122,7 @@ class PostgresContainer : AutoCloseable {
117
122
return
118
123
}
119
124
}
120
-
throwRuntimeException("postgres container '$name' did not become ready within 30s")
125
+
throwRuntimeException("postgres container '$name' did not become ready within ${READY_TIMEOUT_S}s")
121
126
}
122
127
123
128
privatefuncanConnect(): Boolean=try {
@@ -133,6 +138,10 @@ class PostgresContainer : AutoCloseable {
133
138
privateconstvalPG_USER="postgres"
134
139
privateconstvalPG_PASSWORD="test"
135
140
141
+
/** Container readiness bound, seconds. Overridable so a loaded CI box can widen it. */
0 commit comments