Commit 98645c8
fix(integration-tests): gate shared-sidecar mode on a real connection (kills the ts-integration flake) (#167)
The ts integration lane intermittently hung to the scenarios' 60s test timeout
on the main push path (twice: the #163 and #165 merges), always in the
sidecar-backed generated-routes lane (create-201 / jsonb-open-bag-roundtrip).
Root cause: shared-sidecar mode (startOnSharedPostgres) did `admin.connect()`
immediately with NO readiness gate and NO client-side connect timeout — unlike
the per-container path, which deliberately gates on a real `canConnect()` because
`pg_isready` (what the CI `services: postgres` health-check uses) can report
success during postgres' first-boot init window. Under CI host contention the
sidecar is also transiently slow to accept connections. With no connect timeout,
pg's first connection to a not-yet-answering sidecar hangs indefinitely → the
scenario burns its full 60s timeout instead of retrying.
Fix: extend the file's existing readiness pattern to shared mode —
`waitForSharedReady()` polls a real short-timeout probe connection until the
sidecar answers (or a 45s budget, kept under the 60s test timeout so the retry
loop can actually succeed), and every Client now carries connectionTimeoutMillis
so a stalled attempt fails fast and is retried rather than hanging. When the
sidecar is healthy the gate returns on the first probe (~ms); when it never comes
up, it throws a clear error instead of an opaque timeout.
Verified: the two previously-flaky lanes (api-contract-generated,
api-contract-jsonb) run 23/23 green against a real local sidecar in shared mode.
The change can only prevent hangs — no behavior change on the healthy path.
Claude-Session: https://claude.ai/code/session_01Ew1XfYSbEAezxjs9opynAe
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 53fcfcb commit 98645c8
1 file changed
Lines changed: 34 additions & 3 deletions
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
62 | 70 | | |
63 | 71 | | |
64 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
65 | 82 | | |
66 | | - | |
| 83 | + | |
67 | 84 | | |
68 | 85 | | |
69 | 86 | | |
| |||
75 | 92 | | |
76 | 93 | | |
77 | 94 | | |
78 | | - | |
| 95 | + | |
79 | 96 | | |
80 | 97 | | |
81 | 98 | | |
| |||
86 | 103 | | |
87 | 104 | | |
88 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
89 | 120 | | |
90 | 121 | | |
91 | 122 | | |
| |||
113 | 144 | | |
114 | 145 | | |
115 | 146 | | |
116 | | - | |
| 147 | + | |
117 | 148 | | |
118 | 149 | | |
119 | 150 | | |
| |||
0 commit comments