Skip to content

Commit

Permalink
Fix flaky supervisor conflict test (#44760)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
potiuk authored Dec 7, 2024
1 parent e26909d commit c09e9b5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions task_sdk/tests/execution_time/test_supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,22 +389,23 @@ def handle_request(request: httpx.Request) -> httpx.Response:
# 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):
Expand Down

0 comments on commit c09e9b5

Please sign in to comment.