Skip to content

Commit c050c12

Browse files
committed
[SPARK-19113][SS][TESTS] Ignore StreamingQueryException thrown from awaitInitialization to avoid breaking tests
## What changes were proposed in this pull request? #16492 missed one race condition: `StreamExecution.awaitInitialization` may throw fatal errors and fail the test. This PR just ignores `StreamingQueryException` thrown from `awaitInitialization` so that we can verify the exception in the `ExpectFailure` action later. It's fine since `StopStream` or `ExpectFailure` will catch `StreamingQueryException` as well. ## How was this patch tested? Jenkins Author: Shixiong Zhu <shixiong@databricks.com> Closes #16567 from zsxwing/SPARK-19113-2.
1 parent 33791a8 commit c050c12

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,12 @@ trait StreamTest extends QueryTest with SharedSQLContext with Timeouts {
385385
.streamingQuery
386386
// Wait until the initialization finishes, because some tests need to use `logicalPlan`
387387
// after starting the query.
388-
currentStream.awaitInitialization(streamingTimeout.toMillis)
388+
try {
389+
currentStream.awaitInitialization(streamingTimeout.toMillis)
390+
} catch {
391+
case _: StreamingQueryException =>
392+
// Ignore the exception. `StopStream` or `ExpectFailure` will catch it as well.
393+
}
389394

390395
case AdvanceManualClock(timeToAdd) =>
391396
verify(currentStream != null,

0 commit comments

Comments
 (0)