sarutak commented on a change in pull request #32845:
URL: https://github.com/apache/spark/pull/32845#discussion_r648799223
##########
File path: core/src/test/scala/org/apache/spark/SparkContextSuite.scala
##########
@@ -1285,6 +1285,30 @@ class SparkContextSuite extends SparkFunSuite with
LocalSparkContext with Eventu
}
}
}
+
+ test("SPARK-35691: addFile/addJar/addDirectory should put CanonicalFile") {
+ withTempDir { dir =>
+ try {
+ val sep = File.separator
+ val tmpDir = Utils.createTempDir(dir.getAbsolutePath + sep + "." + sep
+ ".")
Review comment:
`Utils.createTempDir` seems return a canonical path. So, this test
doesn't perform as you expect.
Also, it's better to assert the original path is not canonical.
##########
File path: core/src/test/scala/org/apache/spark/SparkContextSuite.scala
##########
@@ -1285,6 +1285,30 @@ class SparkContextSuite extends SparkFunSuite with
LocalSparkContext with Eventu
}
}
}
+
+ test("SPARK-35691: addFile/addJar/addDirectory should put CanonicalFile") {
+ withTempDir { dir =>
+ try {
+ val sep = File.separator
+ val tmpDir = Utils.createTempDir(dir.getAbsolutePath + sep + "." + sep
+ ".")
+ val tmpJar = File.createTempFile("test", ".jar", tmpDir)
+ val tmpFile = File.createTempFile("test", ".txt", tmpDir)
+
+ sc = new SparkContext(new
SparkConf().setAppName("test").setMaster("local"))
+ sc.addJar(tmpJar.getAbsolutePath)
+ sc.addFile(tmpFile.getAbsolutePath)
Review comment:
Could you add a test for directories?
##########
File path: core/src/test/scala/org/apache/spark/SparkContextSuite.scala
##########
@@ -1285,6 +1285,30 @@ class SparkContextSuite extends SparkFunSuite with
LocalSparkContext with Eventu
}
}
}
+
+ test("SPARK-35691: addFile/addJar/addDirectory should put CanonicalFile") {
+ withTempDir { dir =>
+ try {
+ val sep = File.separator
+ val tmpDir = Utils.createTempDir(dir.getAbsolutePath + sep + "." + sep
+ ".")
+ val tmpJar = File.createTempFile("test", ".jar", tmpDir)
+ val tmpFile = File.createTempFile("test", ".txt", tmpDir)
+
+ sc = new SparkContext(new
SparkConf().setAppName("test").setMaster("local"))
Review comment:
`NettyStreamManager.addJar` is not performed if a test runs with `local`
mode, meaning this doesn't test the change of `addFile`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]