You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2017/12/12 20:52:04 UTC

[GitHub] sijie commented on a change in pull request #961: Issue 922: allow run bookie together with broker

sijie 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_r156478728
 
 

 ##########
 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:
   can you explain why it would throw `NoWritableLedgerDirException` when using an empty config?

----------------------------------------------------------------
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