You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/05 07:22:05 UTC

[GitHub] [airflow] potiuk commented on a diff in pull request #22701: Fixed backfill interference with scheduler

potiuk commented on code in PR #22701:
URL: https://github.com/apache/airflow/pull/22701#discussion_r842445573


##########
tests/jobs/test_backfill_job.py:
##########
@@ -581,11 +581,41 @@ def test_backfill_run_rescheduled(self, dag_maker):
         ti.refresh_from_db()
         assert ti.state == State.SUCCESS
 
+    def test_backfill_skip_active_scheduled_dagrun(self, dag_maker):
+        dag = self._get_dummy_dag(
+            dag_maker,
+            dag_id="test_backfill_skip_active_scheduled_dagrun",
+            task_id="test_backfill_skip_active_scheduled_dagrun-1",
+        )
+        dag_maker.create_dagrun(
+            run_type=DagRunType.SCHEDULED,
+            state=State.RUNNING,
+        )
+
+        executor = MockExecutor()
+
+        job = BackfillJob(
+            dag=dag,
+            executor=executor,
+            start_date=DEFAULT_DATE,
+            end_date=DEFAULT_DATE + datetime.timedelta(days=2),
+        )
+        with patch.object(job.log, 'error') as mock_error:
+            job.run()
+            mock_error.assert_called()

Review Comment:
   NIT: I'd also do if assert "Backfill cannot be created" in the error message. It just prevents the case that there is **another** error generated during the 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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org