Miretpl commented on code in PR #73749:
URL: https://github.com/apache/airflow/pull/73749#discussion_r4496828929
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py:
##########
@@ -4114,6 +4114,33 @@ def
test_async_trigger_reentry_returns_when_pod_gcd_on_success(self, mocked_hook
# await_pod_completion in _clean must not be called with self.pod=None
mock_manager.return_value.await_pod_completion.assert_not_called()
+ @patch(POD_MANAGER_CLASS)
+ @patch(HOOK_CLASS)
+ def
test_async_trigger_reentry_raises_pod_not_found_on_success_when_xcom_push(
+ self, mocked_hook, mock_manager
+ ):
+ """Pod GC'd before reentry with do_xcom_push=True must not silently
succeed (issue #73117).
+
+ The XCom sidecar died with the pod, so returning success would leave
the task
+ SUCCESS with no return_value XCom, unrecoverably breaking downstream
tasks.
+ Raising lets the task fail/retry so a fresh pod reproduces the result.
+ """
+ mocked_hook.return_value.get_pod.side_effect =
ApiException(status=404, reason="Not Found")
+ k = KubernetesPodOperator(task_id="task", deferrable=True,
do_xcom_push=True)
+ context = create_context(k)
+ context["ti"] = MagicMock()
Review Comment:
Could you specify `spec` for `MagicMock`? Any `MagicMock` without a `spec`
or `autospec` silently accepts any attribute access
--
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]