Skip to content

Commit

Permalink
[fix][test] Fix flaky test ReplicatorGlobalNSTest#testRemoveLocalClus…
Browse files Browse the repository at this point in the history
…terOnGlobalNamespace (apache#21708)
  • Loading branch information
Technoboy- authored Dec 12, 2023
1 parent 3396065 commit 757723e
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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;
Expand Down Expand Up @@ -90,14 +91,12 @@ public void testRemoveLocalClusterOnGlobalNamespace() throws Exception {

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
Expand Down

0 comments on commit 757723e

Please sign in to comment.