Acehaidrey commented on a change in pull request #9544:
URL: https://github.com/apache/airflow/pull/9544#discussion_r450636937



##########
File path: tests/models/test_dagrun.py
##########
@@ -642,3 +642,27 @@ def test_wait_for_downstream(self, prev_ti_state, 
is_ti_success):
         ti.set_state(State.QUEUED)
         ti.run()
         self.assertEqual(ti.state == State.SUCCESS, is_ti_success)
+
+    @mock.patch.object(DagRun, 
'_emit_true_scheduling_delay_stats_for_finished_state')
+    def test_dag_stats(self, stats_mock):
+        """
+        Tests that dag scheduling delay stat is called.
+        """
+        dag = DAG(
+            dag_id='test_dagrun_stats',
+            start_date=timezone.datetime(2017, 1, 1)
+        )
+        dag_task = DummyOperator(
+            task_id='dummy1',
+            dag=dag
+        )
+
+        initial_task_states = {
+            dag_task.task_id: State.SUCCESS,
+        }
+
+        dag_run = self.create_dag_run(dag=dag,
+                                      state=State.RUNNING,
+                                      task_states=initial_task_states)
+        dag_run.update_state()
+        stats_mock.assert_called()

Review comment:
       Hi @turbaszek thank you for this, the question I had, and I wouldn't 
know if you know. The time value changes, do you know if I can do 
called_once_with,  and then the value be a random?




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

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


Reply via email to