You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2018/08/14 22:16:11 UTC

[GitHub] spark pull request #21849: [SPARK-24243][CORE] Expose exceptions from InProc...

Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21849#discussion_r210120533
  
    --- Diff: core/src/test/java/org/apache/spark/launcher/SparkLauncherSuite.java ---
    @@ -227,6 +220,82 @@ public void testInProcessLauncherDoesNotKillJvm() throws Exception {
         assertEquals(SparkAppHandle.State.LOST, handle.getState());
       }
     
    +  @Test
    +  public void testInProcessLauncherGetError() throws Exception {
    +    // Because this test runs SparkLauncher in process and in client mode, it pollutes the system
    +    // properties, and that can cause test failures down the test pipeline. So restore the original
    +    // system properties after this test runs.
    +    Map<Object, Object> properties = new HashMap<>(System.getProperties());
    +
    +    SparkAppHandle handle = null;
    +    try {
    +      handle = new InProcessLauncher()
    +        .setMaster("local")
    +        .setAppResource(SparkLauncher.NO_RESOURCE)
    +        .setMainClass(ErrorInProcessTestApp.class.getName())
    +        .addAppArgs("hello")
    +        .startApplication();
    +
    +      final SparkAppHandle _handle = handle;
    +      eventually(Duration.ofSeconds(60), Duration.ofMillis(1000), () -> {
    +        assertEquals(SparkAppHandle.State.FAILED, _handle.getState());
    +      });
    +
    +      assertNotNull(handle.getError());
    +      assertTrue(handle.getError().isPresent());
    +      assertTrue(handle.getError().get().getCause() == DUMMY_EXCEPTION);
    --- End diff --
    
    `assertSame`? (Although it's slightly weird to have a static exception instance being thrown.)


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org