Skip to content

Commit 5c31b8a

Browse files
committed
Revert "Remove (all but one) sleep calls from “socket input stream” test"
This reverts commit f8f6c93. Conflicts: streaming/src/test/scala/org/apache/spark/streaming/InputStreamsSuite.scala
1 parent 6ce0681 commit 5c31b8a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
package org.apache.spark.streaming
1919

20+
import akka.actor.Actor
21+
import akka.actor.Props
22+
import akka.util.ByteString
23+
2024
import java.io.{File, BufferedWriter, OutputStreamWriter}
2125
import java.net.{InetSocketAddress, SocketException, ServerSocket}
2226
import java.nio.charset.Charset
@@ -50,7 +54,6 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter {
5054

5155
// Set up the streaming context and input streams
5256
val ssc = new StreamingContext(conf, batchDuration)
53-
val waiter = new StreamingTestWaiter(ssc)
5457
val networkStream = ssc.socketTextStream(
5558
"localhost", testServer.port, StorageLevel.MEMORY_AND_DISK)
5659
val outputBuffer = new ArrayBuffer[Seq[String]] with SynchronizedBuffer[Seq[String]]
@@ -62,12 +65,13 @@ class InputStreamsSuite extends TestSuiteBase with BeforeAndAfter {
6265
val clock = ssc.scheduler.clock.asInstanceOf[ManualClock]
6366
val input = Seq(1, 2, 3, 4, 5)
6467
val expectedOutput: Seq[Seq[String]] = input.map(i => Seq(i.toString))
68+
Thread.sleep(1000)
6569
for (i <- 0 until input.size) {
6670
testServer.send(input(i).toString + "\n")
67-
Thread.sleep(500) // This sleep is to wait for `testServer` to send the data to Spark
71+
Thread.sleep(500)
6872
clock.addToTime(batchDuration.milliseconds)
69-
waiter.waitForBatchToComplete()
7073
}
74+
Thread.sleep(1000)
7175
logInfo("Stopping server")
7276
testServer.stop()
7377
logInfo("Stopping context")

0 commit comments

Comments
 (0)