Skip to content
Snippets Groups Projects
Commit 16a503cf authored by mwws's avatar mwws Committed by Sean Owen
Browse files

[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.
parent a78fbfa6
No related branches found
No related tags found
No related merge requests found
...@@ -140,10 +140,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter { ...@@ -140,10 +140,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter {
} }
test("binary records stream") { test("binary records stream") {
val testDir: File = null var testDir: File = null
try { try {
val batchDuration = Seconds(2) val batchDuration = Seconds(2)
val testDir = Utils.createTempDir() testDir = Utils.createTempDir()
// Create a file that exists before the StreamingContext is created: // Create a file that exists before the StreamingContext is created:
val existingFile = new File(testDir, "0") val existingFile = new File(testDir, "0")
Files.write("0\n", existingFile, StandardCharsets.UTF_8) Files.write("0\n", existingFile, StandardCharsets.UTF_8)
...@@ -363,10 +363,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter { ...@@ -363,10 +363,10 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter {
} }
def testFileStream(newFilesOnly: Boolean) { def testFileStream(newFilesOnly: Boolean) {
val testDir: File = null var testDir: File = null
try { try {
val batchDuration = Seconds(2) val batchDuration = Seconds(2)
val testDir = Utils.createTempDir() testDir = Utils.createTempDir()
// Create a file that exists before the StreamingContext is created: // Create a file that exists before the StreamingContext is created:
val existingFile = new File(testDir, "0") val existingFile = new File(testDir, "0")
Files.write("0\n", existingFile, StandardCharsets.UTF_8) Files.write("0\n", existingFile, StandardCharsets.UTF_8)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment