Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21450#discussion_r194916287
--- Diff:
launcher/src/test/java/org/apache/spark/launcher/SparkSubmitCommandBuilderSuite.java
---
@@ -190,6 +197,36 @@ public void testSparkRShell() throws Exception {
env.get("SPARKR_SUBMIT_ARGS"));
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testExamplesRunnerNoArg() throws Exception {
+ List<String> sparkSubmitArgs =
Arrays.asList(SparkSubmitCommandBuilder.RUN_EXAMPLE);
+ Map<String, String> env = new HashMap<>();
+ buildCommand(sparkSubmitArgs, env);
+ }
+
+ @Test
+ public void testExamplesRunnerNoMainClass() throws Exception {
+ testCLIOpts(SparkSubmitCommandBuilder.RUN_EXAMPLE, parser.HELP, null);
+ testCLIOpts(SparkSubmitCommandBuilder.RUN_EXAMPLE, parser.USAGE_ERROR,
null);
+ testCLIOpts(SparkSubmitCommandBuilder.RUN_EXAMPLE, parser.VERSION,
null);
+ }
+
+ @Rule
+ public ExpectedException testExamplesRunnerWithMasterNoMainClassEx =
ExpectedException.none();
+
+ @Test
+ public void testExamplesRunnerWithMasterNoMainClass() throws Exception {
+
testExamplesRunnerWithMasterNoMainClassEx.expect(IllegalArgumentException.class);
--- End diff --
I have a slight preference for a `try...catch` in this case, which would
also be less code, but either is fine. But I'd pick a shorter and more generic
name for the rule (since it could be reused in other tests if needed later).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]