[fix][test] Absorb Backoff jitter in PulsarServiceNameResolverTest.testRemoveUnavailableHost - #25714
Merged
Conversation
…stRemoveUnavailableHost The Backoff refactor in apache#25278 changed jitter from a one-sided "decrease only, clamped to initial" model to symmetric ±5%. As a result, the first call to Backoff.next() with initialDelay=1000ms can now return up to 1050ms, whereas before it always returned exactly 1000ms. testRemoveUnavailableHost sleeps for exactly INIT_QUARANTINE_TIME_MS (1000ms) and then expects host1 to be recovered. With positive jitter, the recovery delay can exceed the sleep, so the elapsed-time check in computeEndpointStatus returns false and host1 stays unavailable, producing the assertion failure seen on CI. Sleep INIT_QUARANTINE_TIME_MS + 200ms to absorb the ±5% jitter.
lhotari
self-requested a review
May 8, 2026 17:01
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.
Motivation
The Backoff refactor in #25278 changed jitter from a one-sided "decrease only, clamped to initial" model to symmetric ±5%. As a result, the first call to
Backoff.next()withinitialDelay=1000mscan now return up to ~1050ms, whereas before it always returned exactly 1000ms.PulsarServiceNameResolverTest.testRemoveUnavailableHostsleeps for exactlyINIT_QUARANTINE_TIME_MS(1000ms) and then expectshost1to recover. With positive jitter, the recovery delay can exceed the sleep, so the elapsed-time check incomputeEndpointStatusreturns false andhost1stays unavailable, producing a flaky assertion failure on CI:Modifications
Sleep
INIT_QUARANTINE_TIME_MS + 200msinstead of exactlyINIT_QUARANTINE_TIME_MS, to absorb the ±5% jitter applied by the new Backoff implementation.Verifying this change
This change is a trivial test fix.
Verified locally by running the test 5x with
--rerun-tasks:All 5 runs passed.
Does this pull request potentially affect one of the following parts: