dongjoon-hyun commented on a change in pull request #28200:
[SPARK-31432][DEPLOY] bin/sbin scripts should allow to customize jars dir
URL: https://github.com/apache/spark/pull/28200#discussion_r409224445
##########
File path:
launcher/src/test/java/org/apache/spark/launcher/CommandBuilderUtilsSuite.java
##########
@@ -99,6 +111,56 @@ public void testJavaMajorVersion() {
assertEquals(10, javaMajorVersion("10"));
}
+ @Test
+ public void testFindJarsDir() throws IOException {
+ String tmpRoot = tempFolder.getRoot().toString();
+ String sparkHome = tempFolder.newFolder("spark", "home").getAbsolutePath();
+
+ // if SPARK_HOME/jars is missing and there is no dir to fallback, throws
IllegalStateException
+ try {
+ findJarsDir(sparkHome, "2.13", true);
+ } catch (IllegalStateException e) {
+ assertEquals(
+ "Library directory '" + sparkHome +
+ "/assembly/target/scala-2.13/jars' does not exist; make sure Spark is
built.",
+ e.getMessage());
+ }
+
+ // but if failIfNotFound is false, return null without exception
+ assertEquals(null, findJarsDir(sparkHome, "2.13", false));
+
+ // if we have built jars dir, use it as jars dir
+ tempFolder.newFolder("spark", "home", "assembly", "target", "scala-2.13",
"jars");
+ assertEquals(join(File.separator, tmpRoot, "spark", "home", "assembly",
"target",
+ "scala-2.13", "jars"), findJarsDir(sparkHome, "2.13", true));
+
+ // if we have SPARK_HOME/jars, use it as jars dir
+ tempFolder.newFolder("spark", "home", "jars");
+ assertEquals(
+ join(File.separator, tmpRoot, "spark", "home", "jars"),
+ findJarsDir(sparkHome, "2.13", true));
+
+ // if we have SPARK_JARS_DIR, use it as jars dir
+ File spefifiedJarsDir = tempFolder.newFolder("jars-dir");
+ environmentVariables.set("SPARK_JARS_DIR",
spefifiedJarsDir.getAbsolutePath());
Review comment:
`"SPARK_JARS_DIR"` -> `ENV_SPARK_JARS_DIR`.
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]