Commit 9cb8fda
fix(integration): synchronize consumer lag assertion in crash-reject test
TestCrashAfterRejectDoesNotLoseMessages was flaky because it asserted
consumer lag immediately after Ack(), but Ack() only marks the delivery
state — watermark advancement (which updates offset_acked) is deferred
to the next poll loop tick. The test raced against the poll loop: if
the lag check ran before advanceWatermark, offset_acked was still stale
and lag was non-zero.
Fix by adding OnSignal to worker-2's queue and calling waitForSignal
after acks, ensuring the poll loop has run advanceWatermark before we
check lag. This matches the pattern already used by
TestWatermarkAdvancesContiguously.
Verified with 50 consecutive passes (0 failures).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 76ae96e commit 9cb8fda
1 file changed
Lines changed: 8 additions & 1 deletion
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2221 | 2221 | | |
2222 | 2222 | | |
2223 | 2223 | | |
| 2224 | + | |
2224 | 2225 | | |
2225 | 2226 | | |
2226 | 2227 | | |
2227 | 2228 | | |
| 2229 | + | |
2228 | 2230 | | |
2229 | 2231 | | |
2230 | 2232 | | |
| |||
2243 | 2245 | | |
2244 | 2246 | | |
2245 | 2247 | | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
2246 | 2251 | | |
2247 | 2252 | | |
2248 | 2253 | | |
| |||
2254 | 2259 | | |
2255 | 2260 | | |
2256 | 2261 | | |
2257 | | - | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
2258 | 2265 | | |
2259 | 2266 | | |
2260 | 2267 | | |
| |||
0 commit comments