aaron-y-chen commented on code in PR #75923:
URL: https://github.com/apache/airflow/pull/75923#discussion_r4429075364


##########
providers/apache/spark/tests/unit/apache/spark/hooks/test_spark_submit.py:
##########
@@ -1125,6 +1125,32 @@ def test_process_spark_driver_status_log(self):
 
         assert hook._driver_status == "RUNNING"
 
+    @patch("airflow.providers.apache.spark.hooks.spark_submit.time.sleep")
+    
@patch("airflow.providers.apache.spark.hooks.spark_submit.subprocess.Popen")
+    def test_standalone_status_tracking_resets_failures_after_success(self, 
mock_popen, mock_sleep):
+        """Intermittent polling failures must not exhaust the consecutive 
retry limit."""
+        hook = SparkSubmitHook(conn_id="spark_standalone_cluster")
+        hook._driver_id = "driver-123"
+        hook._driver_status = "RUNNING"
+
+        returncodes = [code for _ in range(11) for code in (1, 0)] + [0]
+        processes = []
+
+        for index, returncode in enumerate(returncodes):
+            process = MagicMock()

Review Comment:
   According to 
[AGENTS.md](https://github.com/apache/airflow/blob/740d8bda336e226d2f12257f2a4e84742453fd07/AGENTS.md#L164),
 it should add `spec` when using `MagicMock()`. Other `Popen` mocks in this 
file already use a list spec (e.g. `MagicMock(spec=["stdout", "terminate", 
"wait"])`), and the polling loop only touches `stdout` and `wait`:
   
   ```suggestion
               process = MagicMock(spec=["stdout", "wait"])
   ```



-- 
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