Repository navigation
Fix and disable more flaky failover tests - #4022
Merged
Merged
Conversation
…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.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.shouldTrackSuccessfulCommandsfails because of a race in the client, which this PR does not fix. Test-only changes.Key Decisions & Assumptions
shouldTrackSuccessfulCommandsinstead 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.HealthCheckIntegrationTeststhat only need probes to answer. Duringconnect()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 defaultMAJORITY_AVAILABLEpolicy and two databases, one late result madeconnect()fail withavailable=0, failed=1, pending=1. The test strategy answers at once, so passing tests are not slower.shouldConfigureHealthCheckIntervalAndTimeout: wait up tocustomTimeout + 1000ms 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
HealthCheckIntegrationTestspassed 5 consecutive local runs against Redis 8.10.CircuitBreakerMetricsIntegrationTestsruns 4 tests and skips the disabled one. The original failures were not reproduced locally.Notes
The other three tests in
CircuitBreakerMetricsIntegrationTestsread 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.shouldTrackSuccessfulCommandsis disabled with a note pointing at issue #3567 (async success count after sync return) and planned re-enable after #3670.In
HealthCheckIntegrationTests, a sharedHEALTH_CHECK_TIMEOUT_MS(1000 ms) replaces 10 ms timeouts in eight scenarios that only need probes to respond quickly—avoidingconnect()treating slow CI as failed databases when the first health result is late.shouldConfigureHealthCheckIntervalAndTimeoutalso waits up tocustomTimeout + 1000ms (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.