Copilot commented on code in PR #77305:
URL: https://github.com/apache/airflow/pull/77305#discussion_r4743389257
##########
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:
This new test uses the real wall clock, contrary to the repository's
requirement to use `time_machine` for time-dependent tests. Freeze time for the
test and derive `last_scheduling_decision` from that fixed instant so the
sweep's timestamp eligibility is deterministic.
--
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]