From beb8bc1ea588b7f9ab7effff707c0f784421364d Mon Sep 17 00:00:00 2001 From: zsxwing Date: Mon, 19 Oct 2015 00:06:51 -0700 Subject: [SPARK-11126][SQL] Fix the potential flaky test The unit test added in #9132 is flaky. This is a follow up PR to add `listenerBus.waitUntilEmpty` to fix it. Author: zsxwing Closes #9163 from zsxwing/SPARK-11126-follow-up. --- .../test/scala/org/apache/spark/sql/execution/ui/SQLListenerSuite.scala | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/core') diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLListenerSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLListenerSuite.scala index 03bcee94a2..c15aac7750 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLListenerSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLListenerSuite.scala @@ -316,10 +316,12 @@ class SQLListenerSuite extends SparkFunSuite with SharedSQLContext { test("SPARK-11126: no memory leak when running non SQL jobs") { val previousStageNumber = sqlContext.listener.stageIdToStageMetrics.size sqlContext.sparkContext.parallelize(1 to 10).foreach(i => ()) + sqlContext.sparkContext.listenerBus.waitUntilEmpty(10000) // listener should ignore the non SQL stage assert(sqlContext.listener.stageIdToStageMetrics.size == previousStageNumber) sqlContext.sparkContext.parallelize(1 to 10).toDF().foreach(i => ()) + sqlContext.sparkContext.listenerBus.waitUntilEmpty(10000) // listener should save the SQL stage assert(sqlContext.listener.stageIdToStageMetrics.size == previousStageNumber + 1) } -- cgit v1.2.3