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

    https://github.com/apache/spark/pull/4135#discussion_r26237173
  
    --- 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)
    +
    +      // Verify that receiver was started
    +      assert(receiver.onStartCalled)
    +      assert(executor.isReceiverStarted)
    +      assert(receiver.isStarted)
    +      assert(!receiver.isStopped())
    +      assert(receiver.otherThread.isAlive)
    +
    +      task.kill(false)
    +
    --- End diff --
    
    In fact, there's an example of using `eventually` in this file; see line 
112.


---
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