ephraimbuddy commented on code in PR #40693:
URL: https://github.com/apache/airflow/pull/40693#discussion_r1686166326
##########
tests/models/test_dag.py:
##########
@@ -3024,6 +3024,54 @@ def test_dags_needing_dagruns_datasets(self, dag_maker,
session):
dag_models = query.all()
assert dag_models == [dag_model]
+ def test_dags_needing_dagruns_dataset_aliases(self, dag_maker, session):
+ # link dataset_alias hello_alias to dataset hello
+ dataset_model = DatasetModel(uri="hello")
+ dataset_alias_model = DatasetAliasModel(name="hello_alias")
+ dataset_alias_model.datasets.append(dataset_model)
+ session.add_all([dataset_model, dataset_alias_model])
+ session.commit()
+
+ with dag_maker(
+ session=session,
+ dag_id="my_dag",
+ max_active_runs=1,
+ schedule=[DatasetAlias(name="hello_alias")],
+ start_date=pendulum.now().add(days=-2),
+ ) as dag:
+ EmptyOperator(task_id="dummy")
+
+ # there's no queue record yet, so no runs needed at this time.
+ query, _ = DagModel.dags_needing_dagruns(session)
+ dag_models = query.all()
+ assert dag_models == []
+
+ # add queue records so we'll need a run
+ dag_model = session.query(DagModel).filter(DagModel.dag_id ==
dag.dag_id).one()
Review Comment:
```suggestion
dag_model = dag_maker.dag_model
```
--
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]