Repository: spark
Updated Branches:
  refs/heads/master 4ad492c40 -> b545d7521


[SPARK-14860][TESTS] Create a new Waiter in reset to bypass an issue of 
ScalaTest's Waiter.wait

## What changes were proposed in this pull request?

This PR updates `QueryStatusCollector.reset` to create Waiter instead of 
calling `await(1 milliseconds)` to bypass an ScalaTest's issue that 
Waiter.await may block forever.

## How was this patch tested?

I created a local stress test to call codes in `test("event ordering")` 100 
times. It cannot pass without this patch.

Author: Shixiong Zhu <shixi...@databricks.com>

Closes #12623 from zsxwing/flaky-test.


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

Branch: refs/heads/master
Commit: b545d752195f6dcba4c512b8a1d5bf5b74279dc8
Parents: 4ad492c
Author: Shixiong Zhu <shixi...@databricks.com>
Authored: Tue May 3 11:16:55 2016 -0700
Committer: Tathagata Das <tathagata.das1...@gmail.com>
Committed: Tue May 3 11:16:55 2016 -0700

----------------------------------------------------------------------
 .../spark/sql/util/ContinuousQueryListenerSuite.scala   | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/b545d752/sql/core/src/test/scala/org/apache/spark/sql/util/ContinuousQueryListenerSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/util/ContinuousQueryListenerSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/util/ContinuousQueryListenerSuite.scala
index 3498fe8..2596231 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/util/ContinuousQueryListenerSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/util/ContinuousQueryListenerSuite.scala
@@ -19,8 +19,6 @@ package org.apache.spark.sql.util
 
 import java.util.concurrent.ConcurrentLinkedQueue
 
-import scala.util.control.NonFatal
-
 import org.scalatest.BeforeAndAfter
 import org.scalatest.PrivateMethodTester._
 import org.scalatest.concurrent.AsyncAssertions.Waiter
@@ -164,8 +162,8 @@ class ContinuousQueryListenerSuite extends StreamTest with 
SharedSQLContext with
   }
 
   class QueryStatusCollector extends ContinuousQueryListener {
-
-    private val asyncTestWaiter = new Waiter  // to catch errors in the async 
listener events
+    // to catch errors in the async listener events
+    @volatile private var asyncTestWaiter = new Waiter
 
     @volatile var startStatus: QueryStatus = null
     @volatile var terminationStatus: QueryStatus = null
@@ -175,11 +173,7 @@ class ContinuousQueryListenerSuite extends StreamTest with 
SharedSQLContext with
       startStatus = null
       terminationStatus = null
       progressStatuses.clear()
-
-      // To reset the waiter
-      try asyncTestWaiter.await(timeout(1 milliseconds)) catch {
-        case NonFatal(e) =>
-      }
+      asyncTestWaiter = new Waiter
     }
 
     def checkAsyncErrors(): Unit = {


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

Reply via email to