Repository navigation
Commit b573988
Fixing flaky integration test: TestCrashAfterRejectDoesNotLoseMessages (#274)
## Summary
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.
## Test Plan
Ran the test 50 times to confirm it's no longer flaky:
```
./tool/bazel test //test/integration/extension/messagequeue/mysql:mysql_test --test_filter='TestSQLQueueIntegration/TestCrashAfterRejectDoesNotLoseMessages' --runs_per_test=50 --test_output=summary --jobs=4
INFO: Found 1 test target...
Target //test/integration/extension/messagequeue/mysql:mysql_test up-to-date:
bazel-bin/test/integration/extension/messagequeue/mysql/mysql_test_/mysql_test
INFO: Elapsed time: 205.664s, Critical Path: 20.62s
INFO: 51 processes: 9 action cache hit, 1 internal, 50 darwin-sandbox.
INFO: Build completed successfully, 51 total actions
//test/integration/extension/messagequeue/mysql:mysql_test PASSED in 20.6s
Stats over 50 runs: max = 20.6s, min = 10.0s, avg = 16.0s, dev = 2.0s
Executed 1 out of 1 test: 1 test passes.
```
## Issue
<!--
Link the issue here.
- Use 'Closes #123' if this is the final fix.
- Use 'Part of #123' or just '#123' if the feature is still in progress.
-->
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0475631 commit b573988
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