[fix][test] Fix flaky SameAuthParamsLookupAutoClusterFailoverTest.testAutoClusterFailover() test#25892
Open
oneby-wang wants to merge 1 commit into
Open
Conversation
void-ptr974
approved these changes
May 30, 2026
Contributor
void-ptr974
left a comment
There was a problem hiding this comment.
LGTM. PulsarClientImpl already initializes the ServiceUrlProvider, so this removes the duplicate scheduled check task.
11 tasks
11 tasks
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
SameAuthParamsLookupAutoClusterFailoverTest.testAutoClusterFailovercan fail intermittently when run repeatedly withinvocationCount = 100.The failure reproduced as:
The key flaky signal is that the same failover provider was driven by two scheduled check threads:
The test passed the provider into
PulsarClient.builder().serviceUrlProvider(failover).PulsarClientImplalready initializes the configuredServiceUrlProviderwhile building the client. The test then calledfailover.initialize(client)again manually, creating a second scheduled check task for the same provider instance.Because both scheduled tasks mutate the same failover state, one task can recover the current index back to
0while the other task is still probing index1. A transient failed probe can move index1toPreFail; after the current index is0, the check loop no longer visits index1, so the test waits until timeout with[Healthy, PreFail, Healthy].Modifications
Removed the redundant manual
failover.initialize(client)call fromSameAuthParamsLookupAutoClusterFailoverTest.The provider lifecycle remains managed by
PulsarClientthroughClientBuilder.serviceUrlProvider(...).Verifying this change
This change is already covered by existing tests:
./gradlew :pulsar-broker:test --tests "org.apache.pulsar.broker.SameAuthParamsLookupAutoClusterFailoverTest.testAutoClusterFailover" -PtestRetryCount=0 --no-configuration-cacheDoes this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes