Repository: spark
Updated Branches:
  refs/heads/branch-2.1 77202a6c5 -> 047506bae


[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 <shixi...@databricks.com>

Closes #16567 from zsxwing/SPARK-19113-2.

(cherry picked from commit c050c12274fba2ac4c4938c4724049a47fa59280)
Signed-off-by: Shixiong Zhu <shixi...@databricks.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/047506ba
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/047506ba
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/047506ba

Branch: refs/heads/branch-2.1
Commit: 047506bae4f9a00003505ac886ba04969d8d11f5
Parents: 77202a6
Author: Shixiong Zhu <shixi...@databricks.com>
Authored: Wed Jan 18 10:50:51 2017 -0800
Committer: Shixiong Zhu <shixi...@databricks.com>
Committed: Wed Jan 18 10:51:00 2017 -0800

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/streaming/StreamTest.scala     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/047506ba/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala
index 4aa4100..af2f31a 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamTest.scala
@@ -385,7 +385,12 @@ trait StreamTest extends QueryTest with SharedSQLContext 
with Timeouts {
                 .streamingQuery
             // Wait until the initialization finishes, because some tests need 
to use `logicalPlan`
             // after starting the query.
-            currentStream.awaitInitialization(streamingTimeout.toMillis)
+            try {
+              currentStream.awaitInitialization(streamingTimeout.toMillis)
+            } catch {
+              case _: StreamingQueryException =>
+                // Ignore the exception. `StopStream` or `ExpectFailure` will 
catch it as well.
+            }
 
           case AdvanceManualClock(timeToAdd) =>
             verify(currentStream != null,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to