aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2015-03-06 09:43:24 +0000
committerSean Owen <sowen@cloudera.com>2015-03-06 09:43:24 +0000
commitcd7594ca6acf1226bf91f8a783606bf5c116f7df (patch)
tree4841c7a7ed97db56813e574770f7fe87fddcbcea
parentd8b3da9ddfe44a2886f3841ceef4ebf9fc318640 (diff)
downloadspark-cd7594ca6acf1226bf91f8a783606bf5c116f7df.tar.gz
spark-cd7594ca6acf1226bf91f8a783606bf5c116f7df.tar.bz2
spark-cd7594ca6acf1226bf91f8a783606bf5c116f7df.zip
[core] [minor] Don't pollute source directory when running UtilsSuite.
Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #4921 from vanzin/utils-suite and squashes the following commits: 7795dd4 [Marcelo Vanzin] [core] [minor] Don't pollute source directory when running UtilsSuite.
-rw-r--r--core/src/test/scala/org/apache/spark/util/UtilsSuite.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala b/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
index fd77753c0d..b91428efad 100644
--- a/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
+++ b/core/src/test/scala/org/apache/spark/util/UtilsSuite.scala
@@ -386,10 +386,11 @@ class UtilsSuite extends FunSuite with ResetSystemProperties {
}
test("fetch hcfs dir") {
- val sourceDir = Utils.createTempDir()
+ val tempDir = Utils.createTempDir()
+ val sourceDir = new File(tempDir, "source-dir")
val innerSourceDir = Utils.createTempDir(root=sourceDir.getPath)
val sourceFile = File.createTempFile("someprefix", "somesuffix", innerSourceDir)
- val targetDir = new File(Utils.createTempDir(), "target-dir")
+ val targetDir = new File(tempDir, "target-dir")
Files.write("some text", sourceFile, UTF_8)
val path = new Path("file://" + sourceDir.getAbsolutePath)
@@ -413,7 +414,7 @@ class UtilsSuite extends FunSuite with ResetSystemProperties {
assert(destInnerFile.isFile())
val filePath = new Path("file://" + sourceFile.getAbsolutePath)
- val testFileDir = new File("test-filename")
+ val testFileDir = new File(tempDir, "test-filename")
val testFileName = "testFName"
val testFilefs = Utils.getHadoopFileSystem(filePath.toString, conf)
Utils.fetchHcfsFile(filePath, testFileDir, testFilefs, new SparkConf(),