Skip to content

Commit

Permalink
[fix][broker] PulsarStandalone started with error if --stream-storage…
Browse files Browse the repository at this point in the history
…-port is not 4181 (apache#22993)
  • Loading branch information
zhouyifan279 authored Jul 8, 2024
1 parent ed39c4d commit 17e3f86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public void runStreamStorage(CompositeConfiguration conf) throws Exception {
// create a default namespace
try (StorageAdminClient admin = StorageClientBuilder.newBuilder()
.withSettings(StorageClientSettings.newBuilder()
.serviceUri("bk://localhost:4181")
.serviceUri("bk://localhost:" + streamStoragePort)
.backoffPolicy(Backoff.Jitter.of(
Type.EXPONENTIAL,
1000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

import org.apache.bookkeeper.conf.ServerConfiguration;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -54,4 +56,18 @@ public void testStartStop() throws Exception {
assertFalse(ensemble.getZkClient().getState().isConnected());
assertFalse(ensemble.getBookies()[0].isRunning());
}

@Test(timeOut = 10_000)
public void testStartWithSpecifiedStreamStoragePort() throws Exception {
LocalBookkeeperEnsemble ensemble = null;
try {
ensemble =
new LocalBookkeeperEnsemble(1, 0, 0, 4182, null, null, true, null);
ensemble.startStandalone(new ServerConfiguration(), true);
} finally {
if (ensemble != null) {
ensemble.stop();
}
}
}
}

0 comments on commit 17e3f86

Please sign in to comment.