Skip to content

Commit

Permalink
[fix][test] Fix flaky test PersistentTopicTest.testGetReplicationClus…
Browse files Browse the repository at this point in the history
…ters (apache#19421)
  • Loading branch information
lhotari authored Feb 3, 2023
1 parent 27d392d commit 91c7ef7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public void testProducerOverwrite() {

private void testMaxProducers() {
PersistentTopic topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
topic.initialize();
topic.initialize().join();
String role = "appid1";
// 1. add producer1
Producer producer = new Producer(topic, serverCnx, 1 /* producer id */, "prod-name1", role,
Expand Down Expand Up @@ -2251,7 +2251,7 @@ private ByteBuf getMessageWithMetadata(byte[] data) {
@Test
public void testGetReplicationClusters() throws MetadataStoreException {
PersistentTopic topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
topic.initialize();
topic.initialize().join();
assertEquals(topic.getHierarchyTopicPolicies().getReplicationClusters().get(), Collections.emptyList());

Policies policies = new Policies();
Expand All @@ -2262,7 +2262,7 @@ public void testGetReplicationClusters() throws MetadataStoreException {
.createPolicies(TopicName.get(successTopicName).getNamespaceObject(), policies);

topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
topic.initialize();
topic.initialize().join();
assertEquals(topic.getHierarchyTopicPolicies().getReplicationClusters().get(), namespaceClusters);

TopicPoliciesService topicPoliciesService = mock(TopicPoliciesService.class);
Expand All @@ -2277,7 +2277,7 @@ public void testGetReplicationClusters() throws MetadataStoreException {
when(topicPoliciesService.getTopicPoliciesIfExists(any())).thenReturn(topicPolicies);

topic = new PersistentTopic(successTopicName, ledgerMock, brokerService);
topic.initialize();
topic.initialize().join();
assertEquals(topic.getHierarchyTopicPolicies().getReplicationClusters().get(), namespaceClusters);
}

Expand Down

0 comments on commit 91c7ef7

Please sign in to comment.