This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.11 by this push:
     new 22cb044357b [fix][broker] read local cookie when start pulsar 
standalone (#18260)
22cb044357b is described below

commit 22cb044357b9cbd1543a1b1f5404da6c7f66b74e
Author: labuladong <[email protected]>
AuthorDate: Tue Nov 1 12:45:24 2022 +0800

    [fix][broker] read local cookie when start pulsar standalone (#18260)
---
 .../org/apache/pulsar/PulsarStandaloneTest.java    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java 
b/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
index f4c34bbc96c..bf5d4cb5d31 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/PulsarStandaloneTest.java
@@ -117,4 +117,34 @@ public class PulsarStandaloneTest {
         cleanDirectory(tempDir);
     }
 
+    @Test(groups = "broker")
+    public void testStandaloneWithRocksDB() throws Exception {
+        String[] args = new String[]{"--config",
+                
"./src/test/resources/configurations/pulsar_broker_test_standalone_with_rocksdb.conf"};
+        final int bookieNum = 3;
+        final File tempDir = IOUtils.createTempDir("standalone", "test");
+
+        PulsarStandaloneStarter standalone = new PulsarStandaloneStarter(args);
+        standalone.setBkDir(tempDir.getAbsolutePath());
+        standalone.setNumOfBk(bookieNum);
+
+        standalone.startBookieWithMetadataStore();
+        List<ServerConfiguration> firstBsConfs = 
standalone.bkCluster.getBsConfs();
+        Assert.assertEquals(firstBsConfs.size(), bookieNum);
+        standalone.close();
+
+        // start twice, read cookie from local folder
+        standalone.startBookieWithMetadataStore();
+        List<ServerConfiguration> secondBsConfs = 
standalone.bkCluster.getBsConfs();
+        Assert.assertEquals(secondBsConfs.size(), bookieNum);
+
+        for (int i = 0; i < bookieNum; i++) {
+            ServerConfiguration conf1 = firstBsConfs.get(i);
+            ServerConfiguration conf2 = secondBsConfs.get(i);
+            Assert.assertEquals(conf1.getBookiePort(), conf2.getBookiePort());
+        }
+        standalone.close();
+        cleanDirectory(tempDir);
+    }
+
 }

Reply via email to