ferruzzi commented on code in PR #72296:
URL: https://github.com/apache/airflow/pull/72296#discussion_r3963555707
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py:
##########
@@ -863,6 +879,53 @@ def test_get_dags_no_n_plus_one_queries(self, session,
test_client):
f"({first_query_count} → {second_query_count}), suggesting n+1
queries for tags"
)
+ def test_get_dags_includes_dag_with_deadline(self, dag_maker, test_client,
session):
+ deadline_dag_id = "test_dag_with_deadline"
+ with dag_maker(
+ deadline_dag_id,
+ schedule=None,
+ start_date=DAG1_START_DATE,
+ deadline=DeadlineAlert(
+ reference=DeadlineReference.DAGRUN_LOGICAL_DATE,
+ interval=timedelta(hours=1),
+ callback=_deadline_callback(),
+ ),
+ ):
+ EmptyOperator(task_id="task1")
+ dag_maker.sync_dagbag_to_db()
+
+ response = test_client.get("/dags")
Review Comment:
Could you add an assertion to each of these that the deadline actually
landed in the DB? Right now if you strip the deadline out of the dag_maker
call, these tests should still pass since nothing here is deadline-specific.
You already take `session` as a fixture so asserting the `deadline_alert` rows
exist should be easy.
These two tests are also almost identical, which usually smells like a case
for parameterizing the tests. Maybe combine them into one with a parameterized
deadline and expected_row_count? Up to you.
--
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]