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

    https://github.com/apache/spark/pull/16991#discussion_r102551511
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingQueryListenerSuite.scala
 ---
    @@ -133,6 +133,93 @@ class StreamingQueryListenerSuite extends StreamTest 
with BeforeAndAfter {
         }
       }
     
    +  testQuietly("multiple listeners, check trigger events are generated 
correctly") {
    --- End diff --
    
    It's better to add a regression test rather than copying the above test. 
Most of this test is testing the same thing in `"single listener, check trigger 
events are generated correctly"`. It doesn't make sense. How about this:
    ```
      test("SPARK-19594: all of listeners should receive QueryTerminatedEvent") 
{
        val df = MemoryStream[Int].toDS().as[Long]
        val listeners = (1 to 5).map(_ => new EventCollector)
        try {
          testStream(df, OutputMode.Append)(
            StartStream(),
            StopStream,
            AssertOnQuery { query =>
              eventually(Timeout(streamingTimeout)) {
                listeners.foreach(listener => assert(listener.terminationEvent 
!== null))
                listeners.foreach(listener => 
assert(listener.terminationEvent.id === query.id))
                listeners.foreach(listener => 
assert(listener.terminationEvent.runId === query.runId))
                listeners.foreach(listener => 
assert(listener.terminationEvent.exception === None))
              }
              listeners.foreach(listener => listener.checkAsyncErrors())
              listeners.foreach(listener => listener.reset())
              true
            }
          )
        } finally {
          listeners.foreach(spark.streams.removeListener)
        }
      }
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to