vvysotskyi commented on a change in pull request #1656: DRILL-7056: Drill fails 
with NPE when starting in distributed mode & …
URL: https://github.com/apache/drill/pull/1656#discussion_r262434718
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/test/TestGracefulShutdown.java
 ##########
 @@ -205,6 +212,44 @@ public void 
testDrillbitWithSamePortContainsShutdownThread() throws Exception {
     }
   }
 
+  @Test // DRILL-7056
+  public void testDrillbitTempDir() throws Exception {
+    File originalDrillbitTempDir = null;
+    ClusterFixtureBuilder fixtureBuilder = 
ClusterFixture.bareBuilder(dirTestWatcher).withLocalZk()
+        .configProperty(ExecConstants.ALLOW_LOOPBACK_ADDRESS_BINDING, true)
+        .configProperty(ExecConstants.INITIAL_USER_PORT, 
QueryTestUtil.getFreePortNumber(31170, 300))
+        .configProperty(ExecConstants.INITIAL_BIT_PORT, 
QueryTestUtil.getFreePortNumber(31180, 300));
+
+    try (ClusterFixture fixture = fixtureBuilder.build();
+        Drillbit twinDrillbitOnSamePort = new Drillbit(fixture.config(),
+            fixtureBuilder.configBuilder().getDefinitions(), 
fixture.serviceSet())) {
+      // Assert preconditions :
+      //      1. First drillbit instance should be started normally
+      //      2. Second instance startup should fail, because ports are 
occupied by the first one
+      Drillbit originalDrillbit = fixture.drillbit();
+      assertNotNull("First drillbit instance should be initialized", 
originalDrillbit);
+      originalDrillbitTempDir = getWebServerTempDirPath(originalDrillbit);
+      assertTrue("First drillbit instance should have a temporary Javascript 
dir initialized", originalDrillbitTempDir.exists());
+      try {
+        twinDrillbitOnSamePort.run();
+        fail("Invocation of 'twinDrillbitOnSamePort.run()' should throw 
UserException");
+      } catch (UserException userEx) {
+        assertNull("Second drillbit instance should NOT have a temporary 
Javascript dir", getWebServerTempDirPath(twinDrillbitOnSamePort));
+      } catch (Exception e) {
+        fail("Invocation of 'twinDrillbitOnSamePort.run()' was expected to 
throw a UserException. Actual exception : "+ e.getMessage());
 
 Review comment:
   This check will hide the stack trace of the error. Please either remove this 
catch block or rethrow the exception.

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


With regards,
Apache Git Services

Reply via email to