uranusjr commented on a change in pull request #18226:
URL: https://github.com/apache/airflow/pull/18226#discussion_r713582288
##########
File path: tests/operators/test_trigger_dagrun.py
##########
@@ -250,8 +250,36 @@ def
test_trigger_dagrun_with_wait_for_completion_true_fail(self):
execution_date=execution_date,
wait_for_completion=True,
poke_interval=10,
- failed_states=[State.RUNNING],
+ failed_states=[State.QUEUED],
dag=self.dag,
)
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,
+ 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()
Review comment:
You probably want to add an explicit `order_by` here, the db does not
always return rows in a deterministic order.
--
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]