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

    https://github.com/apache/spark/pull/8818#discussion_r40038464
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/StreamingListenerSuite.scala
 ---
    @@ -140,6 +140,51 @@ class StreamingListenerSuite extends TestSuiteBase 
with Matchers {
         }
       }
     
    +  test("onBatchCompleted") {
    +    ssc = new StreamingContext("local[2]", "test", Milliseconds(1000))
    +    val inputStream = ssc.receiverStream(new 
StreamingListenerSuiteReceiver)
    +    inputStream.foreachRDD(_.count)
    +
    +    @volatile var errorMessage: Option[String] = None
    +    ssc.addStreamingListener(new StreamingListener {
    +      override def onBatchCompleted(batchCompleted: 
StreamingListenerBatchCompleted): Unit = {
    +        errorMessage = batchCompleted.batchInfo.errorMessage
    +      }
    +    })
    +    val batchCounter = new BatchCounter(ssc)
    +    ssc.start()
    +    // Make sure running at least one batch
    +    batchCounter.waitUntilBatchesCompleted(expectedNumCompletedBatches = 
1, timeout = 10000)
    +    ssc.stop()
    +    assert(errorMessage.isEmpty, "A successful batch should not set 
errorMessage")
    +  }
    +
    +  test("onBatchCompleted: error") {
    --- End diff --
    
    onBatchCompleted with failed batch


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