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

shahar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new c09e9b5202c Fix flaky supervisor conflict test (#44760)
c09e9b5202c is described below

commit c09e9b5202ce4f1c6ba02381c0284cb4cd7a84e7
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Dec 7 13:41:44 2024 +0100

    Fix flaky supervisor conflict test (#44760)
    
    The test sometimes runs for a longer time and generates more
    requests - thus producing slightly different output and count
    of requests. This PR accepts bigger request count.
---
 task_sdk/tests/execution_time/test_supervisor.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/task_sdk/tests/execution_time/test_supervisor.py 
b/task_sdk/tests/execution_time/test_supervisor.py
index 6bd3047de67..96506a48bda 100644
--- a/task_sdk/tests/execution_time/test_supervisor.py
+++ b/task_sdk/tests/execution_time/test_supervisor.py
@@ -389,22 +389,23 @@ class TestWatchedSubprocess:
         # Wait for the subprocess to finish -- it should have been terminated
         assert proc.wait() == -signal.SIGTERM
 
+        count_request = request_count["count"]
         # Verify the number of requests made
-        assert request_count["count"] == 2
+        assert count_request >= 2
         assert captured_logs == [
             {
-                "detail": {
-                    "current_state": "success",
-                    "message": "TI is no longer in the running state and task 
should terminate",
-                    "reason": "not_running",
-                },
                 "event": "Server indicated the task shouldn't be running 
anymore",
                 "level": "error",
                 "status_code": 409,
                 "logger": "supervisor",
                 "timestamp": mocker.ANY,
+                "detail": {
+                    "reason": "not_running",
+                    "message": "TI is no longer in the running state and task 
should terminate",
+                    "current_state": "success",
+                },
             }
-        ]
+        ] * (count_request - 1)
 
     @pytest.mark.parametrize("captured_logs", [logging.WARNING], indirect=True)
     def test_heartbeat_failures_handling(self, monkeypatch, mocker, 
captured_logs, time_machine):

Reply via email to