diff options
author | Marcelo Vanzin <vanzin@cloudera.com> | 2016-05-10 10:35:54 -0700 |
---|---|---|
committer | Marcelo Vanzin <vanzin@cloudera.com> | 2016-05-10 10:35:54 -0700 |
commit | 0b9cae42426e14060bc6182c037fd715f35a2d23 (patch) | |
tree | fbf356424566ce8bd027fa034f0be6e58ce73066 /launcher/src/test/java | |
parent | 36c5892b4631d1d5d70e569fce12efedd82bdef0 (diff) | |
download | spark-0b9cae42426e14060bc6182c037fd715f35a2d23.tar.gz spark-0b9cae42426e14060bc6182c037fd715f35a2d23.tar.bz2 spark-0b9cae42426e14060bc6182c037fd715f35a2d23.zip |
[SPARK-11249][LAUNCHER] Throw error if app resource is not provided.
Without this, the code would build an invalid spark-submit command line,
and a more cryptic error would be presented to the user. Also, expose
a constant that allows users to set a dummy resource in cases where
they don't need an actual resource file; for backwards compatibility,
that uses the same "spark-internal" resource that Spark itself uses.
Tested via unit tests, run-example, spark-shell, and running the
thrift server with mixed spark and hive command line arguments.
Author: Marcelo Vanzin <vanzin@cloudera.com>
Closes #12909 from vanzin/SPARK-11249.
Diffstat (limited to 'launcher/src/test/java')
-rw-r--r-- | launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java b/launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java index c7e8b2e03a..c16f46a360 100644 --- a/launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java +++ b/launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java @@ -72,7 +72,8 @@ public class SparkSubmitCommandBuilderSuite extends BaseSuite { parser.CONF, "spark.randomOption=foo", parser.CONF, - SparkLauncher.DRIVER_EXTRA_LIBRARY_PATH + "=/driverLibPath"); + SparkLauncher.DRIVER_EXTRA_LIBRARY_PATH + "=/driverLibPath", + SparkLauncher.NO_RESOURCE); Map<String, String> env = new HashMap<>(); List<String> cmd = buildCommand(sparkSubmitArgs, env); @@ -109,7 +110,8 @@ public class SparkSubmitCommandBuilderSuite extends BaseSuite { List<String> sparkSubmitArgs = Arrays.asList( parser.CLASS + "=org.my.Class", parser.MASTER + "=foo", - parser.DEPLOY_MODE + "=bar"); + parser.DEPLOY_MODE + "=bar", + SparkLauncher.NO_RESOURCE); List<String> cmd = newCommandBuilder(sparkSubmitArgs).buildSparkSubmitArgs(); assertEquals("org.my.Class", findArgValue(cmd, parser.CLASS)); @@ -168,6 +170,11 @@ public class SparkSubmitCommandBuilderSuite extends BaseSuite { assertEquals("42", cmd.get(cmd.size() - 1)); } + @Test(expected = IllegalArgumentException.class) + public void testMissingAppResource() { + new SparkSubmitCommandBuilder().buildSparkSubmitArgs(); + } + private void testCmdBuilder(boolean isDriver, boolean useDefaultPropertyFile) throws Exception { String deployMode = isDriver ? "client" : "cluster"; |