Repository navigation
test(sentinel): await the reentrant teardown instead of a fixed delay - #3651
Merged
nkaradzhov merged 1 commit intoNov 23, 2026
Merged
Conversation
The 'destroy() from an end listener tears down a reentrant reopen' test reopened and tore down from inside the end listener, discarded both promises, then asserted isOpen === false after setTimeout(100). destroy() awaits the reentrant connect()'s in-flight topology discovery before it can finish tearing down, and that discovery is not bounded by any fixed duration. Under load it outran the 100ms window, so the assert ran while the reopen's #setOpen(true) still had isOpen true. Capture the reentrant destroy() and await it, matching the sibling test above. Removes the timing dependence entirely.
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 was referenced Nov 20, 2026
Closed
1 task done
nkaradzhov
approved these changes
Nov 23, 2026
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.
Fixes the signature-B flake from #3650:
RedisSentinel lifecycle events › destroy() from an end listener tears down a reentrant reopenfailingtrue !== falseonassert.equal(sentinel.isOpen, false).Root cause (test-only)
The test reopens and tears down from inside the
endlistener, discards both reentrant promises, then assertsisOpen === falseafter a fixedsetTimeout(100):The reentrant
connect()runs#setOpen(true)synchronously, soisOpenistruethe moment the reopen starts. The reentrantdestroy()is what flips it back — but#doDestroy()firstawaits the reopen's#connectPromise, i.e. its full topology discovery (the SENTINEL round-trips plus opening the master/replica/pubsub clients, or a 1s backoff in#connect's retry loop). That has no constant upper bound, so under CI load it outlasts the 100ms window and the assert runs while#doDestroy()is still blocked andisOpenis stilltrue.This is a timing bug in the test, not in the teardown — the final state is correct once
destroy()settles. The sibling test just above (tracks a reentrant connect() from an end listener) doesn't flake precisely because itawaits thedestroy()promise.Fix
Capture the reentrant
destroy()and await it instead of sleeping:Awaiting the teardown guarantees
#doDestroy()has finished draining the reopen and run its final#setOpen(false)before the asserts, removing the timing dependence entirely.#setReady(true)stays blocked by the#destroyguard throughout, so theready-before-endordering assert still holds.Test-only; no production code touched. Signature A from #3650 (topology stand-up cascade) is separate and not addressed here.
Note
Low Risk
Single test timing fix; no runtime code paths change.
Overview
Fixes a flaky Redis Sentinel lifecycle test (#3650) by awaiting the reentrant
destroy()promise instead of sleeping 100ms before assertions.The test triggers
connect()anddestroy()from anendlistener; teardown must finish the reopen’s in-flight topology work beforeisOpenbecomes false, which under CI load can exceed a fixed delay. Capturing and awaitingreentrantTeardownremoves that race while keeping theready-before-endordering check.Test-only — no production changes.
Reviewed by Cursor Bugbot for commit 5d0bba6. Bugbot is set up for automated code reviews on this repo. Configure here.