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/06/05 13:34:23 UTC

(pulsar) 01/06: [fix][test] Stabilize testSecondaryIsolationGroupsBookiesNegative() test (#25900)

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 edac8b150876220669d408e560830664199830a3
Author: Oneby Wang <44...@users.noreply.github.com>
AuthorDate: Thu Jun 4 03:50:24 2026 +0800

    [fix][test] Stabilize testSecondaryIsolationGroupsBookiesNegative() test (#25900)
    
    (cherry picked from commit 7ab09413c8bccaa759ce5efcd187cd8e7bd81580)
---
 .../rackawareness/IsolatedBookieEnsemblePlacementPolicyTest.java    | 6 ++++++
 1 file changed, 6 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 fc67395c813..d4785d6ca83 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
@@ -595,6 +595,12 @@ 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 the
+        // first newEnsemble call can race with an empty cachedRackConfiguration and skip isolation.
+        Awaitility.await().atMost(Duration.ofSeconds(5)).untilAsserted(() ->
+                assertNotNull(isolationPolicy.getBookieMappingCache()
+                        .getIfCached(BookieRackAffinityMapping.BOOKIE_INFO_ROOT_PATH)));
+
         try {
             isolationPolicy
                     .newEnsemble(3, 3, 2, Collections.emptyMap(), new HashSet<>()).getResult();