This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new e3d060b7f64 Guard the backfill dag-runs list query count and tidy test 
params (#70126)
e3d060b7f64 is described below

commit e3d060b7f64670cc9dba6ea8a6c4ba8bc052826d
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Wed Jul 29 17:16:28 2026 +0200

    Guard the backfill dag-runs list query count and tidy test params (#70126)
    
    The GET /backfills/{backfill_id}/dag_runs endpoint added in #67381 relies on
    joinedload to keep its query count constant, but its tests did not assert 
that,
    so a change that drops the eager-load could silently reintroduce an N+1. 
Add an
    assert_queries_count guard on the happy path (the count stays constant
    regardless of the number of dag runs). Also let the test client encode the 
query
    parameters from a dict instead of hand-building query strings.
---
 .../unit/api_fastapi/core_api/routes/public/test_backfills.py    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
index a8afb9612d6..a083087007d 100644
--- 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
+++ 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py
@@ -251,7 +251,8 @@ class TestListBackfillDagRuns(TestBackfillEndpoint):
         session.add_all([bdr1, bdr2])
         session.commit()
 
-        response = test_client.get(f"/backfills/{b.id}/dag_runs")
+        with assert_queries_count(5):
+            response = test_client.get(f"/backfills/{b.id}/dag_runs")
         assert response.status_code == 200
         data = response.json()
         assert data["total_entries"] == 2
@@ -321,13 +322,13 @@ class TestListBackfillDagRuns(TestBackfillEndpoint):
             )
         session.commit()
 
-        response = 
test_client.get(f"/backfills/{b.id}/dag_runs?limit=2&offset=0")
+        response = test_client.get(f"/backfills/{b.id}/dag_runs", 
params={"limit": 2, "offset": 0})
         assert response.status_code == 200
         data = response.json()
         assert data["total_entries"] == 3
         assert len(data["backfill_dag_runs"]) == 2
 
-        response = 
test_client.get(f"/backfills/{b.id}/dag_runs?limit=2&offset=2")
+        response = test_client.get(f"/backfills/{b.id}/dag_runs", 
params={"limit": 2, "offset": 2})
         assert response.status_code == 200
         data = response.json()
         assert len(data["backfill_dag_runs"]) == 1
@@ -376,7 +377,7 @@ class TestListBackfillDagRuns(TestBackfillEndpoint):
             )
         session.commit()
 
-        response = 
test_client.get(f"/backfills/{b.id}/dag_runs?order_by={order_by}")
+        response = test_client.get(f"/backfills/{b.id}/dag_runs", 
params={"order_by": order_by})
         assert response.status_code == 200
         data = response.json()
         assert data["backfill_dag_runs"][0]["sort_ordinal"] == 
expected_first_ordinal

Reply via email to