Skip to content

Fix and disable more flaky failover tests - #4022

Merged
a-TODO-rov merged 4 commits into
mainfrom
fix-flaky-tests-2
Nov 19, 2026
Merged

a-TODO-rov merged 4 commits into
mainfrom
fix-flaky-tests-2

Conversation

@a-TODO-rov

@a-TODO-rov a-TODO-rov commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Fix and disable more flaky failover tests

Summary

Deals with the failover tests that have kept CI red since #4007. Two health-check tests failed on slow runners because their time limits were only a few milliseconds. CircuitBreakerMetricsIntegrationTests.shouldTrackSuccessfulCommands fails because of a race in the client, which this PR does not fix. Test-only changes.

Key Decisions & Assumptions

  • Disable shouldTrackSuccessfulCommands instead of making it wait. The circuit breaker counts a success in a completion callback that can run after the synchronous call returns. That race is tracked in [automatic failover] Sporadic test failure observed in CircuitBreakerMetricsIntegrationTests #3567 and fixed in the client by [automatic failover] Refactor Circuit Breaker Command Tracking #3670. Waiting for the count in the test would hide the race, so the test is disabled with a note to re-enable it once [automatic failover] Refactor Circuit Breaker Command Tracking #3670 is merged. It failed in 7 of 246 CI test jobs since Nov 10.
  • 1 s health-check timeout instead of 10 ms in the eight HealthCheckIntegrationTests that only need probes to answer. During connect() the client waits at most (timeout + delay) × probes, here 11 ms, for each database's first health result, and counts a missing result as failed. With the default MAJORITY_AVAILABLE policy and two databases, one late result made connect() fail with available=0, failed=1, pending=1. The test strategy answers at once, so passing tests are not slower.
  • Wider margin in shouldConfigureHealthCheckIntervalAndTimeout: wait up to customTimeout + 1000 ms instead of 150 ms for the timed-out check to mark the database UNHEALTHY. The delayed check never completes on its own, so the test still proves that the configured timeout is what marks it failed.

Testing

HealthCheckIntegrationTests passed 5 consecutive local runs against Redis 8.10. CircuitBreakerMetricsIntegrationTests runs 4 tests and skips the disabled one. The original failures were not reproduced locally.

Notes

The other three tests in CircuitBreakerMetricsIntegrationTests read the count the same way but have not failed in the CI runs checked, so they stay enabled.


Note

Low Risk
Test-only changes; no production failover, health-check, or circuit-breaker behavior is modified.

Overview
Stabilizes flaky failover integration tests without changing production code.

CircuitBreakerMetricsIntegrationTests.shouldTrackSuccessfulCommands is disabled with a note pointing at issue #3567 (async success count after sync return) and planned re-enable after #3670.

In HealthCheckIntegrationTests, a shared HEALTH_CHECK_TIMEOUT_MS (1000 ms) replaces 10 ms timeouts in eight scenarios that only need probes to respond quickly—avoiding connect() treating slow CI as failed databases when the first health result is late. shouldConfigureHealthCheckIntervalAndTimeout also waits up to customTimeout + 1000 ms (was +50 ms) so UNHEALTHY is observed reliably when the probe is deliberately stalled.

Reviewed by Cursor Bugbot for commit 79aca5a. Bugbot is set up for automated code reviews on this repo. Configure here.

…sfulCommands

The circuit breaker counts a successful command in a completion callback on
the event loop, which can run after the synchronous call has already returned,
so the test sometimes reads a success count of 0. It failed in 7 of 246 CI test
jobs since Nov 10, on unrelated branches and Redis versions.

The race is tracked in #3567 and fixed in the client by #3670. Re-enable the
test once #3670 is merged.
shouldConfigureHealthCheckIntervalAndTimeout waited only customTimeout + 50 ms
(150 ms) for the delayed health check to time out and mark the database
UNHEALTHY. On a slow runner the scheduling delay pushed it past that limit; it
failed on Redis 8.8 and 8.10 in the same main run on Nov 11. Wait up to
customTimeout + 1000 ms. The delayed check never completes on its own, so the
test still proves that the configured timeout is what marks it failed.
Eight tests used a 10 ms health check timeout. During connect() the client
waits at most (timeout + delay) x probes, here 11 ms, for the first health
result of each database and counts a missing result as a failed database. On a
slow runner that made shouldTriggerFailoverOnUnhealthyStatus fail with
"Initialization failed due to initialization policy: available=0, failed=1,
pending=1": the default MAJORITY_AVAILABLE policy needs both of its two
databases.

None of these tests tests the timeout, and the test strategy answers at once,
so a shared 1 s HEALTH_CHECK_TIMEOUT_MS does not slow passing tests.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T14:15:59.061721Z 79aca5a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@a-TODO-rov
a-TODO-rov merged commit 596df2a into main Nov 19, 2026
11 checks passed
@a-TODO-rov
a-TODO-rov deleted the fix-flaky-tests-2 branch November 19, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant