Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21849#discussion_r216058998
--- 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());
+ assertSame(handle.getError().get(), DUMMY_EXCEPTION);
+ } finally {
+ if (handle != null) {
+ handle.kill();
+ }
+ restoreSystemProperties(properties);
+ waitForSparkContextShutdown();
--- End diff --
This isn't really necessary since `ErrorInProcessTestApp` does not create a
context; but not a big deal either.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]