This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new a2c4be0a834f [SPARK-47233][CONNECT][SS][FOLLOW-UP] Add eventually for 
terminated event assert
a2c4be0a834f is described below

commit a2c4be0a834f584f3fef012cf43d78c12a6e209f
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Fri Jun 28 13:50:29 2024 +0900

    [SPARK-47233][CONNECT][SS][FOLLOW-UP] Add eventually for terminated event 
assert
    
    ### What changes were proposed in this pull request?
    
    This PR is a followup of https://github.com/apache/spark/pull/46037 that 
adds eventually to terminated event checking
    
    ### Why are the changes needed?
    
    This test is flaky 
(https://github.com/apache/spark/actions/runs/9706286442/job/26789758573).
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, test-only.
    
    ### How was this patch tested?
    
    Manually
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #47139 from HyukjinKwon/SPARK-47233-followup.
    
    Authored-by: Hyukjin Kwon <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../pyspark/sql/tests/connect/streaming/test_parity_listener.py  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py 
b/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py
index a785fe47f9a1..14edfa4003b2 100644
--- a/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py
+++ b/python/pyspark/sql/tests/connect/streaming/test_parity_listener.py
@@ -23,6 +23,7 @@ from pyspark.sql.tests.streaming.test_streaming_listener 
import StreamingListene
 from pyspark.sql.streaming.listener import StreamingQueryListener
 from pyspark.sql.functions import count, lit
 from pyspark.testing.connectutils import ReusedConnectTestCase
+from pyspark.testing.utils import eventually
 
 
 # Listeners that has spark commands in callback handler functions
@@ -160,8 +161,12 @@ class 
StreamingListenerParityTests(StreamingListenerTestsMixin, ReusedConnectTes
             self.assertTrue(slow_query.id in [str(e.progress.id) for e in 
listener.progress])
             self.assertTrue(fast_query.id in [str(e.progress.id) for e in 
listener.progress])
 
-            self.assertTrue(slow_query.id in [str(e.id) for e in 
listener.terminated])
-            self.assertTrue(fast_query.id in [str(e.id) for e in 
listener.terminated])
+            eventually(timeout=20, catch_assertions=True)(
+                lambda: self.assertTrue(slow_query.id in [str(e.id) for e in 
listener.terminated])
+            )()
+            eventually(timeout=20, catch_assertions=True)(
+                lambda: self.assertTrue(fast_query.id in [str(e.id) for e in 
listener.terminated])
+            )()
 
         finally:
             for listener in self.spark.streams._sqlb._listener_bus:


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

Reply via email to