jscheffl commented on code in PR #67955:
URL: https://github.com/apache/airflow/pull/67955#discussion_r3364585033
##########
task-sdk/tests/task_sdk/execution_time/test_task_runner.py:
##########
@@ -4904,6 +4904,43 @@ def test_handle_trigger_dag_run_conflict(
]
mock_supervisor_comms.assert_has_calls(expected_calls)
+ @time_machine.travel("2025-01-01 00:00:00", tick=False)
+ def test_handle_trigger_dag_run_reraises_original_error(self,
create_runtime_ti, mock_supervisor_comms):
+ """
+ When an ``except`` handler in ``run()`` raises before binding
``state``,
+ the original exception must propagate
+ """
+ from airflow.providers.standard.operators.trigger_dagrun import
TriggerDagRunOperator
+
+ class _TriggerSendError(Exception):
+ pass
+
+ task = TriggerDagRunOperator(
+ task_id="test_task",
+ trigger_dag_id="missing_dag",
+ trigger_run_id="test_run_id",
+ )
+ ti = create_runtime_ti(
+ dag_id="test_handle_trigger_dag_run_reraises_original_error",
+ run_id="test_run",
+ task=task,
+ )
+
+ def _send(msg=None, **kwargs):
+ # Fail only the TriggerDagRun comms (the call that would 404 for a
+ # missing DAG); let every earlier send behave as the default mock.
+ if isinstance(msg, TriggerDagRun):
+ raise _TriggerSendError("simulated 404 for missing target DAG")
+ return mock.DEFAULT
+
+ mock_supervisor_comms.send.side_effect = _send
+
+ log = mock.MagicMock()
Review Comment:
I see risk very very low that n a pytzest we miss a bug just because the log
objetc is called with a wrong method. THink we can keep as-is
--
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]