Skip to content
Snippets Groups Projects
Commit 9108eff7 authored by Tathagata Das's avatar Tathagata Das
Browse files

[SPARK-10098] [STREAMING] [TEST] Cleanup active context after test in FailureSuite

Failures in streaming.FailureSuite can leak StreamingContext and SparkContext which fails all subsequent tests

Author: Tathagata Das <tathagata.das1565@gmail.com>

Closes #8289 from tdas/SPARK-10098.
parent c635a16f
No related branches found
No related tags found
No related merge requests found
......@@ -17,25 +17,32 @@
package org.apache.spark.streaming
import org.apache.spark.Logging
import java.io.File
import org.scalatest.BeforeAndAfter
import org.apache.spark.{SparkFunSuite, Logging}
import org.apache.spark.util.Utils
/**
* This testsuite tests master failures at random times while the stream is running using
* the real clock.
*/
class FailureSuite extends TestSuiteBase with Logging {
class FailureSuite extends SparkFunSuite with BeforeAndAfter with Logging {
val directory = Utils.createTempDir()
val numBatches = 30
private val batchDuration: Duration = Milliseconds(1000)
private val numBatches = 30
private var directory: File = null
override def batchDuration: Duration = Milliseconds(1000)
override def useManualClock: Boolean = false
before {
directory = Utils.createTempDir()
}
override def afterFunction() {
Utils.deleteRecursively(directory)
super.afterFunction()
after {
if (directory != null) {
Utils.deleteRecursively(directory)
}
StreamingContext.getActive().foreach { _.stop() }
}
test("multiple failures with map") {
......
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