From d16710b4c986f0eaf28552ce0e2db33d8c9343b8 Mon Sep 17 00:00:00 2001 From: Shixiong Zhu Date: Tue, 22 Mar 2016 16:41:55 -0700 Subject: [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 Closes #11902 from zsxwing/hotfix. --- sql/core/src/test/scala/org/apache/spark/sql/StreamTest.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) + } } } -- cgit v1.2.3