pierrejeambrun commented on code in PR #62910:
URL: https://github.com/apache/airflow/pull/62910#discussion_r2907249175
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py:
##########
@@ -1511,6 +1511,17 @@ def test_bad_state(self, test_client):
== f"Invalid value for state. Valid values are {',
'.join(TaskInstanceState)}"
)
+ def test_query_count_is_bounded(self, test_client, session):
+ """Regression test for #62027: get_task_instances must not emit
duplicate JOINs.
+
+ Expected: 1 auth query + 1 COUNT + 1 main SELECT (dag_run, dag_version,
+ task_instance_note all eager-loaded via JOIN) = 3 queries total.
+ """
+ self.create_task_instances(session)
+ with assert_queries_count(3):
+ response = test_client.get("/dags/~/dagRuns/~/taskInstances")
+ assert response.status_code == 200
+
Review Comment:
What is achieving this test? Number of queries is also 3 before the change
in this PR.
--
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]