You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2026/05/13 13:15:11 UTC
(pulsar) 01/04: [fix][test] Fix flaky testGetExcludedBookiesWithIsolationGroups (#25640)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 235275d1206ddc2bdc006b694023f896724243fd
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Fri May 1 06:09:54 2026 -0700
[fix][test] Fix flaky testGetExcludedBookiesWithIsolationGroups (#25640)
(cherry picked from commit 6edd35defd2bc78c943b0542b210d394ec3b8690)
---
.../rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java b/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java
index 936b04386ff..0dc996c7d7d 100644
--- a/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java
+++ b/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java
@@ -751,6 +751,13 @@ public class IsolatedBookieEnsemblePlacementPolicyTest {
NullStatsLogger.INSTANCE, BookieSocketAddress.LEGACY_BOOKIEID_RESOLVER);
isolationPolicy.onClusterChanged(writableBookies, readOnlyBookies);
+ // Wait for the async cache load triggered by initialize() to complete; otherwise
+ // getExcludedBookiesWithIsolationGroups returns an empty set when cachedRackConfiguration
+ // is still null. Same pattern used in testBookieInfoChange (#25473).
+ Awaitility.await().atMost(Duration.ofSeconds(5)).untilAsserted(() ->
+ assertNotNull(isolationPolicy.getBookieMappingCache()
+ .getIfCached(BookieRackAffinityMapping.BOOKIE_INFO_ROOT_PATH)));
+
/* Test common cases */
MutablePair<Set<String>, Set<String>> groups = new MutablePair<>();
groups.setLeft(Sets.newHashSet(isolationGroup1));