diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-07-25 18:26:29 -0700 |
---|---|---|
committer | Tathagata Das <tathagata.das1565@gmail.com> | 2016-07-25 18:26:29 -0700 |
commit | e164a04b2ba3503e5c14cd1cd4beb40e0b79925a (patch) | |
tree | 3a7af8468bdc5d74476fc0cc1079de9154821dd7 | |
parent | db36e1e75d69d63b76312e85ae3a6c95cebbe65e (diff) | |
download | spark-e164a04b2ba3503e5c14cd1cd4beb40e0b79925a.tar.gz spark-e164a04b2ba3503e5c14cd1cd4beb40e0b79925a.tar.bz2 spark-e164a04b2ba3503e5c14cd1cd4beb40e0b79925a.zip |
[SPARK-16722][TESTS] Fix a StreamingContext leak in StreamingContextSuite when eventually fails
## What changes were proposed in this pull request?
This PR moves `ssc.stop()` into `finally` for `StreamingContextSuite.createValidCheckpoint` to avoid leaking a StreamingContext since leaking a StreamingContext will fail a lot of tests and make us hard to find the real failure one.
## How was this patch tested?
Jenkins unit tests
Author: Shixiong Zhu <shixiong@databricks.com>
Closes #14354 from zsxwing/ssc-leak.
-rw-r--r-- | streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala b/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala index 806e181f61..f1482e5c06 100644 --- a/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala +++ b/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala @@ -819,10 +819,13 @@ class StreamingContextSuite extends SparkFunSuite with BeforeAndAfter with Timeo ssc.checkpoint(checkpointDirectory) ssc.textFileStream(testDirectory).foreachRDD { rdd => rdd.count() } ssc.start() - eventually(timeout(10000 millis)) { - assert(Checkpoint.getCheckpointFiles(checkpointDirectory).size > 1) + try { + eventually(timeout(30000 millis)) { + assert(Checkpoint.getCheckpointFiles(checkpointDirectory).size > 1) + } + } finally { + ssc.stop() } - ssc.stop() checkpointDirectory } |