This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 757723e4c03 [fix][test] Fix flaky test 
ReplicatorGlobalNSTest#testRemoveLocalClusterOnGlobalNamespace (#21708)
757723e4c03 is described below

commit 757723e4c03b2aa2e5203e90fdb9ecb255e18a3b
Author: Jiwei Guo <[email protected]>
AuthorDate: Tue Dec 12 17:16:21 2023 +0800

    [fix][test] Fix flaky test 
ReplicatorGlobalNSTest#testRemoveLocalClusterOnGlobalNamespace (#21708)
---
 .../pulsar/broker/service/ReplicatorGlobalNSTest.java     | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorGlobalNSTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorGlobalNSTest.java
index 62ba0e83c86..4296f3f4168 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorGlobalNSTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/service/ReplicatorGlobalNSTest.java
@@ -25,6 +25,7 @@ import org.apache.pulsar.client.api.MessageRoutingMode;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.impl.ConsumerImpl;
 import org.apache.pulsar.client.impl.ProducerImpl;
+import org.awaitility.Awaitility;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -90,14 +91,12 @@ public class ReplicatorGlobalNSTest extends 
ReplicatorTestBase {
 
         admin1.namespaces().setNamespaceReplicationClusters(namespace, 
Sets.newHashSet("r2", "r3"));
 
-        MockedPulsarServiceBaseTest
-                .retryStrategically((test) -> 
!pulsar1.getBrokerService().getTopics().containsKey(topicName), 50, 150);
-
-        
Assert.assertFalse(pulsar1.getBrokerService().getTopics().containsKey(topicName));
-        Assert.assertFalse(producer1.isConnected());
-        Assert.assertFalse(consumer1.isConnected());
-        Assert.assertTrue(consumer2.isConnected());
-
+        Awaitility.await().atMost(1, TimeUnit.MINUTES).untilAsserted(() -> {
+            
Assert.assertFalse(pulsar1.getBrokerService().getTopics().containsKey(topicName));
+            Assert.assertFalse(producer1.isConnected());
+            Assert.assertFalse(consumer1.isConnected());
+            Assert.assertTrue(consumer2.isConnected());
+        });
     }
 
     @Test

Reply via email to