Skip to content

Commit bfce947

Browse files
committed
[SPARK-24663][STREAMING][TESTS] StreamingContextSuite: Wait until slow receiver has been initialized, but with hard timeout
1 parent 151b954 commit bfce947

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ class StreamingContextSuite extends SparkFunSuite with BeforeAndAfter with TimeL
368368
}
369369
ssc.start()
370370
ssc.awaitTerminationOrTimeout(500)
371+
eventually(timeout(10.seconds), interval(10.millis)) {
372+
assert(SlowTestReceiver.initialized)
373+
}
371374
ssc.stop(stopSparkContext = false, stopGracefully = true)
372375
logInfo("Running count = " + runningCount)
373376
assert(runningCount > 0)
@@ -974,6 +977,7 @@ class SlowTestReceiver(totalRecords: Int, recordsPerSecond: Int)
974977
}
975978
receivingThreadOption = Some(thread)
976979
thread.start()
980+
SlowTestReceiver.initialized = true
977981
}
978982

979983
def onStop() {
@@ -986,6 +990,7 @@ class SlowTestReceiver(totalRecords: Int, recordsPerSecond: Int)
986990
}
987991

988992
object SlowTestReceiver {
993+
var initialized = false
989994
var receivedAllRecords = false
990995
}
991996

0 commit comments

Comments
 (0)