seanghaeli commented on code in PR #68917:
URL: https://github.com/apache/airflow/pull/68917#discussion_r3788087912


##########
airflow-core/tests/unit/models/test_dagrun.py:
##########
@@ -1509,71 +1511,121 @@ def 
test_dagrun_success_handles_empty_deadline_list(self, mock_prune, dag_maker,
         mock_prune.assert_not_called()
         assert dag_run.state == DagRunState.SUCCESS
 
-    @mock.patch.object(Variable, "get")
+    @pytest.mark.parametrize(
+        ("interval", "failure"),
+        [
+            pytest.param(VariableInterval("missing_key"), nullcontext(), 
id="missing_variable"),
+            pytest.param(
+                datetime.timedelta(hours=1),
+                mock.patch(
+                    
"airflow.serialization.definitions.dag.decode_deadline_alert",
+                    autospec=True,
+                    side_effect=ValueError("corrupt deadline alert blob"),
+                ),
+                id="decode_failure",
+            ),
+            pytest.param(
+                datetime.timedelta(hours=1),
+                mock.patch.object(
+                    SerializedReferenceModels.FixedDatetimeDeadline,
+                    "evaluate_with",
+                    autospec=True,
+                    side_effect=RuntimeError("evaluate_with failed"),
+                ),
+                id="evaluate_with_failure",
+            ),
+        ],
+    )
     @mock.patch.object(Deadline, "prune_deadlines")
-    def test_dagrun_deadline_variable_interval_stable(self, _, mock_get, 
session, deadline_test_dag):

Review Comment:
   This PR rewrites the path that's tested here so it forced a decision about 
what to do with the test: delete it or update it. Upon further inspecting the 
test, I think it never asserted anything useful about deadlines to begin with, 
so I decided to delete it:
   
   when the test does `dag_run.update_state(session)` it doesn't actually 
update the deadline. Therefore, the test can never possibly fail to begin with.
   
   
https://github.com/apache/airflow/blob/c74cfcbae17aa4aa89e66afca8e92035f957aba5/airflow-core/src/airflow/models/dagrun.py#L1371-L1381
   
   In the source code for `update_state` the only logic for deadlines is 
pruning on success. Perhaps this points to a gap in `update_state`, but that's 
something we can address in a separate issue.



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