keemgdeok commented on code in PR #74143:
URL: https://github.com/apache/airflow/pull/74143#discussion_r4172923651


##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/triggers/test_job.py:
##########
@@ -83,6 +83,31 @@ def test_serialize(self, trigger):
             "do_xcom_push": XCOM_PUSH,
         }
 
+    @pytest.mark.asyncio
+    @pytest.mark.parametrize("poll_interval", [0.5, 60])
+    @mock.patch(f"{HOOK_PATH}.get_job_status", autospec=True)
+    
@mock.patch("airflow.providers.cncf.kubernetes.hooks.kubernetes.asyncio.sleep", 
autospec=True)
+    async def test_run_uses_configured_poll_interval(
+        self, mock_sleep, mock_get_job_status, trigger, poll_interval
+    ):
+        trigger.poll_interval = poll_interval
+        pending_job = k8s.V1Job(
+            metadata=k8s.V1ObjectMeta(name=JOB_NAME, namespace=NAMESPACE),
+            status=k8s.V1JobStatus(),
+        )
+        completed_job = k8s.V1Job(
+            metadata=k8s.V1ObjectMeta(name=JOB_NAME, namespace=NAMESPACE),
+            
status=k8s.V1JobStatus(conditions=[k8s.V1JobCondition(type="Complete", 
status="True")]),
+        )
+        mock_get_job_status.side_effect = [pending_job, completed_job]
+
+        event = await trigger.run().asend(None)
+
+        mock_sleep.assert_awaited_once_with(poll_interval)
+        assert mock_get_job_status.await_count == 2
+        assert event.payload["status"] == "success"
+        assert event.payload["job"] == completed_job.to_dict()

Review Comment:
   Thanks for the suggestion. Removed the dedicated polling-loop test and 
parameterized the existing success test with `0.5` and `60`. Both cases still 
fail without the fix because the hook call omits `poll_interval`. The updated 
trigger test module passes all 6 tests.
   
   ---
   Drafted-by: Codex (GPT-6) (no human review before posting)



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