diff options
author | mwws <wei.mao@intel.com> | 2016-05-09 09:44:37 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-05-09 09:44:37 +0100 |
commit | 16a503cf0af3e7c703d56a1a730e4f3a534f6b3c (patch) | |
tree | 66cf06ec875d824127e0127d67754d3c38ce472d | |
parent | a78fbfa619a13421b294328b80c82510ca7efed0 (diff) | |
download | spark-16a503cf0af3e7c703d56a1a730e4f3a534f6b3c.tar.gz spark-16a503cf0af3e7c703d56a1a730e4f3a534f6b3c.tar.bz2 spark-16a503cf0af3e7c703d56a1a730e4f3a534f6b3c.zip |
[MINOR][TEST][STREAMING] make "testDir" able to be claened after test.
It's a minor bug in test case. `val testDir = null` will keep be `null` as it's immutable, so in finally block, nothing will be cleaned. Another `testDir` variable created in try block is only visible in try block.
## How was this patch tested?
Run existing test case and passed.
Author: mwws <wei.mao@intel.com>
Closes #12999 from mwws/SPARK_MINOR.
-rw-r--r-- | streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala b/streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala index a2653000af..6b4c15f345 100644 --- a/streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala +++ b/streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala @@ -140,10 +140,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter { } test("binary records stream") { - val testDir: File = null + var testDir: File = null try { val batchDuration = Seconds(2) - val testDir = Utils.createTempDir() + testDir = Utils.createTempDir() // Create a file that exists before the StreamingContext is created: val existingFile = new File(testDir, "0") Files.write("0\n", existingFile, StandardCharsets.UTF_8) @@ -363,10 +363,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter { } def testFileStream(newFilesOnly: Boolean) { - val testDir: File = null + var testDir: File = null try { val batchDuration = Seconds(2) - val testDir = Utils.createTempDir() + testDir = Utils.createTempDir() // Create a file that exists before the StreamingContext is created: val existingFile = new File(testDir, "0") Files.write("0\n", existingFile, StandardCharsets.UTF_8) |