This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new d146c49e938 [fix][test] Fix flaky BrokerRegistryIntegrationTest port
binding race (#25463)
d146c49e938 is described below
commit d146c49e9388c80b36c6977e2628f92e8346e0af
Author: Matteo Merli <[email protected]>
AuthorDate: Mon Apr 6 19:47:23 2026 -0700
[fix][test] Fix flaky BrokerRegistryIntegrationTest port binding race
(#25463)
(cherry picked from commit aaf2defe4bad3fc06a080718b53599bd2aeb4333)
---
.../loadbalance/extensions/BrokerRegistryIntegrationTest.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryIntegrationTest.java
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryIntegrationTest.java
index e975671fa12..588b1c7730e 100644
---
a/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryIntegrationTest.java
+++
b/pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryIntegrationTest.java
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
-import org.apache.bookkeeper.util.PortManager;
import org.apache.pulsar.broker.PulsarService;
import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.loadbalance.LoadManager;
@@ -41,14 +40,14 @@ import org.testng.annotations.Test;
public class BrokerRegistryIntegrationTest {
private static final String clusterName = "test";
- private final int zkPort = PortManager.nextFreePort();
- private final LocalBookkeeperEnsemble bk = new LocalBookkeeperEnsemble(2,
zkPort, PortManager::nextFreePort);
+ private LocalBookkeeperEnsemble bk;
private PulsarService pulsar;
private BrokerRegistry brokerRegistry;
private String brokerMetadataPath;
@BeforeClass
protected void setup() throws Exception {
+ bk = new LocalBookkeeperEnsemble(2, 0, () -> 0);
bk.start();
pulsar = new PulsarService(brokerConfig());
pulsar.start();
@@ -68,7 +67,9 @@ public class BrokerRegistryIntegrationTest {
pulsar.close();
}
final var elapsedMs = System.currentTimeMillis() - startMs;
- bk.stop();
+ if (bk != null) {
+ bk.stop();
+ }
if (elapsedMs > 5000) {
throw new RuntimeException("Broker took " + elapsedMs + "ms to
close");
}