Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4135#discussion_r26236828
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/ReceiverSuite.scala ---
    @@ -129,6 +130,41 @@ class ReceiverSuite extends TestSuiteBase with 
Timeouts with Serializable {
         }
       }
     
    +  test("kill receiver") {
    +    val sparkConf = new SparkConf()
    +      .setMaster("local[4]")
    +      .setAppName(framework)
    +    val batchDuration = Milliseconds(1000)
    +    withStreamingContext(new StreamingContext(sparkConf, batchDuration)) { 
ssc =>
    +      val receiver = new FakeReceiver
    +      val executor = new FakeReceiverSupervisor(receiver)
    +      val task = new FakeReceiverTask(0, executor)
    +
    +      new Thread("Receiver Task") {
    +        override def run(): Unit = {
    +          task.run(0, 0)
    +        }
    +      }.start()
    +      Thread.sleep(2000)
    --- End diff --
    
    If we can help it, we shouldn't be writing any new streaming tests that 
rely on Thread.sleep, since this has been a major cause of test flakiness.  See 
the use of ManualClock in the other streaming tests for examples of how to 
write tests which aren't dependent on wall-clock time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to