ferruzzi commented on code in PR #70714:
URL: https://github.com/apache/airflow/pull/70714#discussion_r3817624038
##########
airflow-core/tests/unit/models/test_taskinstance.py:
##########
Review Comment:
This line is also catching you up now. If this was a VariableInterval, this
would blow up. You should replace with with `interval=serialize(interval),`
for a more accurate test.
##########
airflow-core/tests/unit/models/test_taskinstance.py:
##########
@@ -4108,8 +4108,28 @@ async def empty_callback_for_deadline():
pass
-def test_clear_task_instances_recalculates_dagrun_queued_deadlines(dag_maker,
session):
+def test_clear_task_instances_recalculates_dagrun_queued_deadlines(dag_maker,
session, monkeypatch):
"""Test that clearing tasks recalculates all (and only) DAGRUN_QUEUED_AT
deadlines."""
+ evaluation_calls = []
+
+ class QueuedDeadlineReference:
+ def evaluate_with(self, *, session, interval, dagrun, dag_id, run_id):
+ evaluation_calls.append(
+ {
+ "session": session,
+ "interval": interval,
+ "dagrun": dagrun,
+ "dag_id": dag_id,
+ "run_id": run_id,
+ }
+ )
+ return dagrun.queued_at + interval
+
+ monkeypatch.setattr(
+ "airflow.models.taskinstance.decode_deadline_reference",
+ lambda reference: QueuedDeadlineReference(),
+ )
Review Comment:
Yeah, I think this patch is hiding something on you. You are just passing
whatever through it rather than checking if it's the right type. I think these
new changes can (and should?) be a new test anyway, you are testing that
context is passed and that clearing a TI recalculates the deadline in the same
test.
--
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]