pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] zhaijack commented on a change in pull request #961: Issue 922: allow run bookie together with broker
Date Thu, 01 Jan 1970 00:00:00 GMT
zhaijack commented on a change in pull request #961: Issue 922: allow run bookie together with
broker
URL: https://github.com/apache/incubator-pulsar/pull/961#discussion_r156564844
 
 

 ##########
 File path: pulsar-broker/src/test/java/org/apache/pulsar/PulsarBrokerStarterTest.java
 ##########
 @@ -270,4 +277,70 @@ public void testMainWithNoArgument() throws Exception {
             // code should reach here.
         }
     }
+
+
+    /**
+     * Verifies that the main throws {@link IllegalArgumentException}
+     * when no config file for bookie and bookie auto recovery is given.
+     */
+    @Test
+    public void testMainRunBookieAndAutoRecoveryNoConfig() throws Exception {
+        try {
+            File testConfigFile = createValidBrokerConfigFile();
+            String[] args = {testConfigFile.getAbsolutePath(), "-a", "-b"};
+            PulsarBrokerStarter.main(args);
+            Assert.fail("No Config file for bookie auto recovery should've raised IllegalArgumentException!");
+        } catch (IllegalArgumentException e) {
+            // code should reach here.
+            Assert.assertEquals(e.getMessage(), "No configuration file for bookie");
+        }
+    }
+
+    /**
+     * Verifies that the main throws {@link IllegalArgumentException}
+     * when no config file for bookie auto recovery is given.
+     */
+    @Test
+    public void testMainRunBookieRecoveryNoConfig() throws Exception {
+        try {
+            File testConfigFile = createValidBrokerConfigFile();
+            String[] args = {testConfigFile.getAbsolutePath(), "-a"};
+            PulsarBrokerStarter.main(args);
+            Assert.fail("No Config file for bookie auto recovery should've raised IllegalArgumentException!");
+        } catch (IllegalArgumentException e) {
+            // code should reach here.
+            Assert.assertEquals(e.getMessage(), "No configuration file for bookie auto recovery");
+        }
+    }
+
+    /**
+     * Verifies that the main throws {@link IllegalArgumentException} when no config file
for bookie is given.
+     */
+    @Test
+    public void testMainRunBookieNoConfig() throws Exception {
+        try {
+            File testConfigFile = createValidBrokerConfigFile();
+            String[] args = {testConfigFile.getAbsolutePath(), "-b"};
+            PulsarBrokerStarter.main(args);
+            Assert.fail("No Config file for bookie should've raised IllegalArgumentException!");
+        } catch (IllegalArgumentException e) {
+            // code should reach here
+            Assert.assertEquals(e.getMessage(), "No configuration file for bookie");
+        }
+    }
+
+    /**
+     * Verifies that the main throws {@link IllegalArgumentException} when no config file
for bookie is given.
+     */
+    @Test
+    public void testMainRunBookieEmptyConfig() throws Exception {
+        try {
+            File testConfigFile = createValidBrokerConfigFile();
+            String[] args = {testConfigFile.getAbsolutePath(), "-a", "-b", "-c", testConfigFile.getAbsolutePath()};
+            PulsarBrokerStarter.main(args);
+            Assert.fail("Effectively empty config file for bookie should've raised NoWritableLedgerDirException!");
+        } catch (LedgerDirsManager.NoWritableLedgerDirException e) {
 
 Review comment:
   thanks, will add a comments for it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message