test(redis): deflake Misskey/BullMQ compat tests on CI#779
Conversation
Two compat tests flaked intermittently on ubuntu-latest:
- `TestRedis_MisskeyConnectionCompatibility`
The two consecutive `SET ... PX 200 NX` calls at line 28 and
line 32 race against the 200ms TTL: when the gap between the
two RPCs slipped past 200ms (slow CI scheduling + Raft commit
latency under -race), the first key expired before the second
SET, the NX took effect, and the `require.ErrorIs(redis.Nil)`
assertion failed. PX bumped to 2000ms (10× safety margin).
The downstream `time.Sleep(1100 * time.Millisecond)` + Get-nil
assertion is unaffected because that path tests the EX 1
timer set at line 35, which is a separate TTL.
- `TestRedis_BullMQDirectCommands`
The `XRead` and `BZPopMin` blocking calls used `Block: 1s` /
`BZPopMin(ctx, time.Second, ...)`. When the producing XAdd /
ZAdd Raft commit took longer than ~900ms (the window left
after the 100ms `time.Sleep` synchronization barrier), the
blocking read timed out with `redis.Nil` and the test failed
with "received nil error" rather than the expected XStream /
ZWithKey result. Block / timeout bumped to 5s, and the outer
`select` deadline bumped from 2s to 6s to keep it bounded by
the inner block.
These are timing-window adjustments only — no production code or
semantics change, no fail-closed / error-handling change. Caller
audit not applicable.
Verified locally with:
GOCACHE=$(pwd)/.cache go test -race \
-run 'TestRedis_MisskeyConnectionCompatibility|TestRedis_BullMQDirectCommands' \
-count=3 ./adapter/
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR increases timeout parameters in two Redis compatibility tests to prevent flakiness on slow CI. ChangesTest timeout resilience on slow CI
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request increases various timeouts and TTL values in the Redis compatibility tests to prevent flaky failures on slow CI runners. Specifically, it extends the blocking duration for XRead and BZPopMin commands, increases the test case timeouts, and raises the TTL for SET ... NX operations to ensure Raft-replicated commands do not race against expiry. I have no feedback to provide.
Summary
Two compat tests under
adapter/flaked intermittently on ubuntu-latest CI in recent PRs (#755, #762). Both are timing races against tight TTLs / block timeouts that slip past on slow CI runners under-race. This PR widens the windows. No production code or semantics change.TestRedis_MisskeyConnectionCompatibilitySET ... PX 200 NX× 2 — when the gap between the two consecutive Raft-replicated SETs exceeded 200ms, the first key expired before the second SET, the NX took effect, and therequire.ErrorIs(redis.Nil)assertion failed.Fix: PX 200 → PX 2000 (10× safety margin). The downstream
time.Sleep(1100ms)+ Get-nil expiry check is unaffected — that path tests theEX 1timer set later, which is a separate TTL.TestRedis_BullMQDirectCommandsXRead Block: time.SecondandBZPopMin(ctx, time.Second, ...)— when the producingXAdd/ZAddRaft commit took longer than ~900ms, the blocking read timed out withredis.Niland the test failed with "received nil error" rather than the expected result.Fix: Block / timeout 1s → 5s; outer select deadline 2s → 6s.
Self-review
-count=3 -racelocally.Test plan
go test -race -run 'TestRedis_MisskeyConnectionCompatibility|TestRedis_BullMQDirectCommands' -count=3 ./adapter/→ passubuntu-latestSummary by CodeRabbit