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

shahar1 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 fe3ad5f1191 Add regression tests for pools API with unlimited (-1) 
slots (#68773)
fe3ad5f1191 is described below

commit fe3ad5f1191ad03f1714882a0350baafb7dd4762
Author: deepinsight coder <[email protected]>
AuthorDate: Sat Jun 20 09:11:22 2026 -0700

    Add regression tests for pools API with unlimited (-1) slots (#68773)
---
 .../core_api/routes/public/test_pools.py           | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
index a383713fe88..d779359d9cc 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
@@ -178,6 +178,28 @@ class TestGetPool(TestPoolsEndpoint):
             "team_name": None,
         }
 
+    def test_get_unlimited_pool_should_respond_200(self, test_client, session):
+        """Regression for #65377: an unlimited (-1 slots) pool has open_slots 
== inf internally; the
+        response must serialize open_slots as -1 and return 200, not 500."""
+        # Seed the DB row directly to exercise the GET/read path that #65377 
reported.
+        session.add(Pool(pool="unlimited_pool", slots=-1, 
include_deferred=False))
+        session.commit()
+        response = test_client.get("/pools/unlimited_pool")
+        assert response.status_code == 200
+        assert response.json() == {
+            "deferred_slots": 0,
+            "description": None,
+            "include_deferred": False,
+            "name": "unlimited_pool",
+            "occupied_slots": 0,
+            "open_slots": -1,
+            "queued_slots": 0,
+            "running_slots": 0,
+            "scheduled_slots": 0,
+            "slots": -1,
+            "team_name": None,
+        }
+
 
 class TestGetPools(TestPoolsEndpoint):
     @pytest.mark.parametrize(
@@ -238,6 +260,18 @@ class TestGetPools(TestPoolsEndpoint):
         assert body["total_entries"] == 2
         assert [pool["name"] for pool in body["pools"]] == 
[Pool.DEFAULT_POOL_NAME, POOL1_NAME]
 
+    def test_get_pools_with_unlimited_pool_should_respond_200(self, 
test_client, session):
+        """Regression for #65377: listing pools that include an unlimited (-1 
slots) pool must serialize
+        open_slots as -1 through the collection serializer and return 200, not 
500."""
+        # Seed the DB row directly to exercise the GET/read path that #65377 
reported.
+        session.add(Pool(pool="unlimited_pool", slots=-1, 
include_deferred=False))
+        session.commit()
+        response = test_client.get("/pools")
+        assert response.status_code == 200
+        pools = {pool["name"]: pool for pool in response.json()["pools"]}
+        assert pools["unlimited_pool"]["slots"] == -1
+        assert pools["unlimited_pool"]["open_slots"] == -1
+
 
 class TestPatchPool(TestPoolsEndpoint):
     @pytest.mark.parametrize(

Reply via email to