diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-03-22 16:41:55 -0700 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2016-03-22 16:41:55 -0700 |
commit | d16710b4c986f0eaf28552ce0e2db33d8c9343b8 (patch) | |
tree | 811848f3daa87981f0d4dd9d6515294234466732 | |
parent | d6dc12ef0146ae409834c78737c116050961f350 (diff) | |
download | spark-d16710b4c986f0eaf28552ce0e2db33d8c9343b8.tar.gz spark-d16710b4c986f0eaf28552ce0e2db33d8c9343b8.tar.bz2 spark-d16710b4c986f0eaf28552ce0e2db33d8c9343b8.zip |
[HOTFIX][SQL] Add a timeout for 'cq.stop'
## What changes were proposed in this pull request?
Fix an issue that DataFrameReaderWriterSuite may hang forever.
## How was this patch tested?
Existing tests.
Author: Shixiong Zhu <shixiong@databricks.com>
Closes #11902 from zsxwing/hotfix.
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala b/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala index f356cde9cf..26c597bf34 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala @@ -28,6 +28,7 @@ import scala.util.control.NonFatal import org.scalatest.Assertions import org.scalatest.concurrent.{Eventually, Timeouts} +import org.scalatest.concurrent.Eventually.timeout import org.scalatest.concurrent.PatienceConfiguration.Timeout import org.scalatest.exceptions.TestFailedDueToTimeoutException import org.scalatest.time.Span @@ -67,7 +68,14 @@ trait StreamTest extends QueryTest with Timeouts { implicit class RichContinuousQuery(cq: ContinuousQuery) { def stopQuietly(): Unit = quietly { - cq.stop() + try { + failAfter(10.seconds) { + cq.stop() + } + } catch { + case e: TestFailedDueToTimeoutException => + logError(e.getMessage(), e) + } } } |