Commit 0fb7db7
authored
test(redis): fix flaky TestRedis_LuaRPopLPushBullMQLikeLists (#596)
## Summary
- `TestRedis_LuaRPopLPushBullMQLikeLists` flaked on CI with `etcd raft
engine is not leader` on the first `RPush` right after `createNode(t,
3)` returned. The freshly-elected raft leader briefly stepped down
("stepped down to follower since quorum is not active") before the
test's first write reached it, so the write raced a re-election.
- Root cause is benign startup leader churn on slow GitHub Actions
runners under `-race` — not a product bug. `waitForRaftReadiness` only
confirms that a leader exists at one instant, which is not enough to
guarantee stability for the very next write.
- Add small `rpushEventually` / `lpushEventually` helpers (backed by a
shared `doEventually` that retries only on `strings.Contains(err, "not
leader")` for 5s at 50ms intervals) and use them for the first two
writes in the flaky test. `waitForRaftReadiness` is intentionally left
untouched because other tests rely on its exact semantics.
Failing CI run:
https://github.com/bootjp/elastickv/actions/runs/24842581631/job/72720509753
## Test plan
- [x] `go test -race -run TestRedis_LuaRPopLPushBullMQLikeLists
./adapter/ -count=5` — 5/5 pass locally.
- [x] `go test -race ./adapter/... -timeout 900s` — only unrelated
pre-existing flake `Test_grpc_transaction` fires (nil-pointer panic in
teardown); explicitly out of scope per the fix request.
- [x] `golangci-lint run ./adapter/...` — 0 issues.
- [ ] Re-run CI job linked above to confirm the flake is gone.2 files changed
Lines changed: 64 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| |||
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
0 commit comments