amoghrajesh commented on code in PR #56762:
URL: https://github.com/apache/airflow/pull/56762#discussion_r2451199720


##########
task-sdk/tests/task_sdk/api/test_client.py:
##########
@@ -225,6 +225,42 @@ def test_retry_handling_ok(self, mock_sleep):
         assert len(responses) == 1
         assert mock_sleep.call_count == 0
 
+    @mock.patch("time.sleep", return_value=None)
+    def test_retry_handling_network_error(self, mock_sleep):
+        """Test that network errors trigger retry and eventually recover."""
+        call_count = 0
+
+        def handle_request(request: httpx.Request) -> httpx.Response:
+            nonlocal call_count
+            call_count += 1
+            if call_count < 3:
+                raise httpx.NetworkError("Connection failed")
+            return httpx.Response(200, json={"detail": "Recovered from error"})
+
+        client = make_client(transport=httpx.MockTransport(handle_request))
+        response = client.get("http://error";)
+        assert response.status_code == 200
+        assert call_count == 3
+        assert mock_sleep.call_count == 2
+
+    @mock.patch("time.sleep", return_value=None)

Review Comment:
   Made changes to the entire file
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to