Skip to content

Commit

Permalink
[fix][test] Address flaky GetPartitionMetadataMultiBrokerTest (apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari authored Oct 14, 2024
1 parent e2fb0da commit 0c4108b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
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;
Expand All @@ -56,7 +57,7 @@

@Test(groups = "broker-admin")
@Slf4j
public class GetPartitionMetadataTest {
public class GetPartitionMetadataTest extends TestRetrySupport {

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

Expand All @@ -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.
Expand All @@ -85,8 +88,10 @@ protected void setup() throws Exception {
admin1.namespaces().createNamespace(DEFAULT_NS);
}

@Override
@AfterClass(alwaysRun = true)
protected void cleanup() throws Exception {
markCurrentSetupNumberCleaned();
cleanupBrokers();
if (bkEnsemble != null) {
bkEnsemble.stop();
Expand Down Expand Up @@ -236,7 +241,7 @@ public void testCompatibilityForNewClientAndOldBroker(TopicDomain topicDomain) t
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");
Expand Down

0 comments on commit 0c4108b

Please sign in to comment.