Skip to content
Snippets Groups Projects
Commit d16710b4 authored by Shixiong Zhu's avatar Shixiong Zhu
Browse files

[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.
parent d6dc12ef
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ import scala.util.control.NonFatal ...@@ -28,6 +28,7 @@ import scala.util.control.NonFatal
import org.scalatest.Assertions import org.scalatest.Assertions
import org.scalatest.concurrent.{Eventually, Timeouts} import org.scalatest.concurrent.{Eventually, Timeouts}
import org.scalatest.concurrent.Eventually.timeout
import org.scalatest.concurrent.PatienceConfiguration.Timeout import org.scalatest.concurrent.PatienceConfiguration.Timeout
import org.scalatest.exceptions.TestFailedDueToTimeoutException import org.scalatest.exceptions.TestFailedDueToTimeoutException
import org.scalatest.time.Span import org.scalatest.time.Span
...@@ -67,7 +68,14 @@ trait StreamTest extends QueryTest with Timeouts { ...@@ -67,7 +68,14 @@ trait StreamTest extends QueryTest with Timeouts {
implicit class RichContinuousQuery(cq: ContinuousQuery) { implicit class RichContinuousQuery(cq: ContinuousQuery) {
def stopQuietly(): Unit = quietly { def stopQuietly(): Unit = quietly {
cq.stop() try {
failAfter(10.seconds) {
cq.stop()
}
} catch {
case e: TestFailedDueToTimeoutException =>
logError(e.getMessage(), e)
}
} }
} }
......
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