[fix][test] Fix flaky IsolatedBookieEnsemblePlacementPolicyTest.testMetadataStoreCases#25474
Merged
nodece merged 1 commit intoapache:masterfrom Apr 7, 2026
Merged
Conversation
…p timing with manual future completion The test used Thread.sleep-based timing to control when CompletableFutures complete, but on fast machines the thread can complete earlier than expected, causing the test to see unexpected cache values. Replace with manually- controlled future completion at the exact points needed.
nodece
approved these changes
Apr 7, 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.
Motivation
IsolatedBookieEnsemblePlacementPolicyTest.testMetadataStoreCasesis flaky because it usesThread.sleep-based timing to control whenCompletableFutures complete. On fast machines, the background thread can complete earlier than expected, causinggetExcludedBookiesWithIsolationGroupsto see the updated cache value before the test expects it.Stack trace
Modifications
Replace the
Thread.sleep-based timing with manually-controlledCompletableFuturecompletion at the exact test points where the futures should transition from pending to complete. This eliminates the timing race entirely.Documentation
doc-not-needed