kaxil commented on a change in pull request #18226:
URL: https://github.com/apache/airflow/pull/18226#discussion_r711271422



##########
File path: tests/operators/test_trigger_dagrun.py
##########
@@ -255,3 +255,34 @@ def 
test_trigger_dagrun_with_wait_for_completion_true_fail(self):
         )
         with pytest.raises(AirflowException):
             task.run(start_date=execution_date, end_date=execution_date)
+
+    def test_trigger_dagrun_triggering_itself(self):
+        """Test TriggerDagRunOperator that triggers itself"""
+        execution_date = DEFAULT_DATE
+        task = TriggerDagRunOperator(
+            task_id="test_task",
+            trigger_dag_id=self.dag.dag_id,
+            allowed_states=[State.RUNNING, State.SUCCESS],
+            dag=self.dag,
+        )
+        task.run(start_date=execution_date, end_date=execution_date)
+
+        with create_session() as session:
+            dagruns = session.query(DagRun).filter(DagRun.dag_id == 
self.dag.dag_id).all()
+            assert len(dagruns) == 2
+            dagruns[1].set_state()
+            # assert isinstance(dagruns[1].start_date, datetime)

Review comment:
       You can just assert that state of 2nd DagRun -- that it is marked as 
`State.QUEUED`.
   




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


Reply via email to