Skip to content

Commit fc78357

Browse files
committed
[fix][test] Address flaky GetPartitionMetadataMultiBrokerTest (apache#23456)
(cherry picked from commit 0c4108b)
1 parent 1179f3e commit fc78357

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/GetPartitionMetadataTest.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.apache.pulsar.common.policies.data.TenantInfoImpl;
4848
import org.apache.pulsar.common.policies.data.TopicType;
4949
import org.apache.pulsar.common.util.FutureUtil;
50+
import org.apache.pulsar.tests.TestRetrySupport;
5051
import org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble;
5152
import org.awaitility.Awaitility;
5253
import org.testng.annotations.AfterClass;
@@ -56,7 +57,7 @@
5657

5758
@Test(groups = "broker-admin")
5859
@Slf4j
59-
public class GetPartitionMetadataTest {
60+
public class GetPartitionMetadataTest extends TestRetrySupport {
6061

6162
protected static final String DEFAULT_NS = "public/default";
6263

@@ -72,8 +73,10 @@ public class GetPartitionMetadataTest {
7273
protected PulsarClientImpl clientWithHttpLookup1;
7374
protected PulsarClientImpl clientWitBinaryLookup1;
7475

76+
@Override
7577
@BeforeClass(alwaysRun = true)
7678
protected void setup() throws Exception {
79+
incrementSetupNumber();
7780
bkEnsemble = new LocalBookkeeperEnsemble(3, 0, () -> 0);
7881
bkEnsemble.start();
7982
// Start broker.
@@ -85,8 +88,10 @@ protected void setup() throws Exception {
8588
admin1.namespaces().createNamespace(DEFAULT_NS);
8689
}
8790

91+
@Override
8892
@AfterClass(alwaysRun = true)
8993
protected void cleanup() throws Exception {
94+
markCurrentSetupNumberCleaned();
9095
cleanupBrokers();
9196
if (bkEnsemble != null) {
9297
bkEnsemble.stop();
@@ -236,7 +241,7 @@ public void testCompatibilityForNewClientAndOldBroker(TopicDomain topicDomain) t
236241
String pulsarUrl = pulsar1.getBrokerServiceUrl();
237242
PulsarClientImpl[] clients = getClientsToTest(false);
238243
for (PulsarClientImpl client : clients) {
239-
client.getLookup(pulsarUrl).getBroker(TopicName.get(DEFAULT_NS + "/tp1"));
244+
client.getLookup(pulsarUrl).getBroker(TopicName.get(DEFAULT_NS + "/tp1")).join();
240245
}
241246
// Inject a not support flag into the connections initialized.
242247
Field field = ClientCnx.class.getDeclaredField("supportsGetPartitionedMetadataWithoutAutoCreation");

0 commit comments

Comments
 (0)