Skip to content

Commit 7ab0941

Browse files
authored
[fix][test] Stabilize testSecondaryIsolationGroupsBookiesNegative() test (#25900)
1 parent e22fa0b commit 7ab0941

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ public void testSecondaryIsolationGroupsBookiesNegative() throws Exception {
590590
NullStatsLogger.INSTANCE, BookieSocketAddress.LEGACY_BOOKIEID_RESOLVER);
591591
isolationPolicy.onClusterChanged(writableBookies, readOnlyBookies);
592592

593+
// Wait for the async cache load triggered by initialize() to complete; otherwise the
594+
// first newEnsemble call can race with an empty cachedRackConfiguration and skip isolation.
595+
Awaitility.await().atMost(Duration.ofSeconds(5)).untilAsserted(() ->
596+
assertNotNull(isolationPolicy.getBookieMappingCache()
597+
.getIfCached(BookieRackAffinityMapping.BOOKIE_INFO_ROOT_PATH)));
598+
593599
try {
594600
isolationPolicy
595601
.newEnsemble(3, 3, 2, Collections.emptyMap(), new HashSet<>()).getResult();

0 commit comments

Comments
 (0)