Skip to content

Add regression tests for pools API with unlimited (-1) slots#68148

Open
Vamsi-klu wants to merge 2 commits into
apache:mainfrom
Vamsi-klu:fix/pools-inf-slots-65377
Open

Add regression tests for pools API with unlimited (-1) slots#68148
Vamsi-klu wants to merge 2 commits into
apache:mainfrom
Vamsi-klu:fix/pools-inf-slots-65377

Conversation

@Vamsi-klu
Copy link
Copy Markdown
Contributor

@Vamsi-klu Vamsi-klu commented Jun 7, 2026

What

Adds two regression tests to airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py covering the GET single (GET /pools/{name}) and GET list (GET /pools) paths for a pool with unlimited (-1) slots. Test-only change — no production code is modified.

Why

The pools REST endpoints used to 500 when a pool had unlimited/infinite slots (#65377): internally open_slots is inf, which fails the response-schema integer validation. That bug is already fixed on main by #61140, which added a _sanitize_open_slots validator (airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py) that maps open_slots from inf to -1 on PoolResponse.

However, the only existing test for that conversion (test_post_pool_allows_unlimited_slots) exercises the POST (create) path. The scenario the issue actually reports — listing pre-existing unlimited pools — was untested. These tests cover the DB-read (GET single) and collection-serializer (GET list) paths so the conversion cannot silently regress there.

Impact

No behavior change and no production code change on main; this only adds test coverage. The endpoints continue to serialize open_slots as -1 and return 200 for unlimited pools.

Testing

Two tests added (both seed Pool(pool="unlimited_pool", slots=-1, include_deferred=False)):

  • TestGetPool.test_get_unlimited_pool_should_respond_200GET /pools/unlimited_pool returns 200 and the response body serializes both slots and open_slots as -1 (rather than inf / a 500).
  • TestGetPools.test_get_pools_with_unlimited_pool_should_respond_200GET /pools returns 200 and the unlimited pool in the collection has slots == -1 and open_slots == -1, exercising the collection serializer.

closes: #65377


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Jun 7, 2026
@Vamsi-klu
Copy link
Copy Markdown
Contributor Author

Small test-only PR adding GET-path regression coverage for the unlimited-slots (-1) pools behavior — the production fix already landed on main in #61140, this just guards the GET single + GET list serializers against regressing.

cc @pierrejeambrun @shubhamraj-git (api_fastapi code owners) — would appreciate a review when you have a moment. Happy to adjust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Airflow Stable REST API /api/v1/pools returns 500 when pool has infinite slots (open_slots = inf)

1 participant