You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2024/10/14 11:09:32 UTC

(pulsar) branch master updated: [fix][test] Address flaky GetPartitionMetadataMultiBrokerTest (#23456)

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 0c4108b8208 [fix][test] Address flaky GetPartitionMetadataMultiBrokerTest (#23456)
0c4108b8208 is described below

commit 0c4108b8208bc84761ca8d03bd111b46ca39bdf8
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Mon Oct 14 14:09:25 2024 +0300

    [fix][test] Address flaky GetPartitionMetadataMultiBrokerTest (#23456)
---
 .../org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java
index e9a639697d9..d06f6ea1c56 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java
@@ -47,6 +47,7 @@ import org.apache.pulsar.common.policies.data.ClusterDataImpl;
 import org.apache.pulsar.common.policies.data.TenantInfoImpl;
 import org.apache.pulsar.common.policies.data.TopicType;
 import org.apache.pulsar.common.util.FutureUtil;
+import org.apache.pulsar.tests.TestRetrySupport;
 import org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble;
 import org.awaitility.Awaitility;
 import org.testng.annotations.AfterClass;
@@ -56,7 +57,7 @@ import org.testng.annotations.Test;
 
 @Test(groups = "broker-admin")
 @Slf4j
-public class GetPartitionMetadataTest {
+public class GetPartitionMetadataTest extends TestRetrySupport {
 
     protected static final String DEFAULT_NS = "public/default";
 
@@ -72,8 +73,10 @@ public class GetPartitionMetadataTest {
     protected PulsarClientImpl clientWithHttpLookup1;
     protected PulsarClientImpl clientWitBinaryLookup1;
 
+    @Override
     @BeforeClass(alwaysRun = true)
     protected void setup() throws Exception {
+        incrementSetupNumber();
         bkEnsemble = new LocalBookkeeperEnsemble(3, 0, () -> 0);
         bkEnsemble.start();
         // Start broker.
@@ -85,8 +88,10 @@ public class GetPartitionMetadataTest {
         admin1.namespaces().createNamespace(DEFAULT_NS);
     }
 
+    @Override
     @AfterClass(alwaysRun = true)
     protected void cleanup() throws Exception {
+        markCurrentSetupNumberCleaned();
         cleanupBrokers();
         if (bkEnsemble != null) {
             bkEnsemble.stop();
@@ -236,7 +241,7 @@ public class GetPartitionMetadataTest {
         String pulsarUrl = pulsar1.getBrokerServiceUrl();
         PulsarClientImpl[] clients = getClientsToTest(false);
         for (PulsarClientImpl client : clients) {
-            client.getLookup(pulsarUrl).getBroker(TopicName.get(DEFAULT_NS + "/tp1"));
+            client.getLookup(pulsarUrl).getBroker(TopicName.get(DEFAULT_NS + "/tp1")).join();
         }
         // Inject a not support flag into the connections initialized.
         Field field = ClientCnx.class.getDeclaredField("supportsGetPartitionedMetadataWithoutAutoCreation");