amoghrajesh commented on code in PR #77305:
URL: https://github.com/apache/airflow/pull/77305#discussion_r4752879232
##########
airflow-core/tests/unit/jobs/test_scheduler_job.py:
##########
@@ -10677,6 +10677,44 @@ def test_update_dagrun_state_for_paused_dag(self,
dag_maker, session):
(scheduled_run,) = DagRun.find(dag_id=dag.dag_id,
run_type=DagRunType.SCHEDULED, session=session)
assert scheduled_run.state == State.SUCCESS
+ def test_update_dagrun_state_for_paused_dag_survives_failed_flush(self,
dag_maker, session, caplog):
+ """A failed flush, as when a concurrent clear re-keys a task instance,
must not escape the sweep."""
+ with dag_maker("testdag") as dag:
+ EmptyOperator(task_id="task1")
+
+ scheduled_run = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED)
+ scheduled_run.last_scheduling_decision =
datetime.datetime.now(timezone.utc) - timedelta(minutes=1)
Review Comment:
`test_update_dagrun_state_for_paused_dag_survives_failed_flush` uses
`datetime.datetime.now(...)`. `AGENTS.md` says use `time_machine`. Wrap the
test in `time_machine.travel(...)` and derive `last_scheduling_decision` from
that instant. The neighbour test at `10646` has the same habit, but a new test
should not copy it.
--
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]