Add regression tests for pools API with unlimited (-1) slots#68148
Add regression tests for pools API with unlimited (-1) slots#68148Vamsi-klu wants to merge 2 commits into
Conversation
|
Small test-only PR adding GET-path regression coverage for the unlimited-slots ( cc @pierrejeambrun @shubhamraj-git (api_fastapi code owners) — would appreciate a review when you have a moment. Happy to adjust. |
pierrejeambrun
left a comment
There was a problem hiding this comment.
Closing, this was already handled as part of https://github.com/apache/airflow/pull/65466/changes.
In tests/api_connexion/schemas/test_pool_schemas.py test test_serialize
Feel free to re-open if I missed something
|
I updated and force-pushed the branch with the FastAPI GET-route coverage plus the datamodel hardening test, but GitHub would not let me reopen this PR ( |
What
Adds two regression tests to
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.pycovering 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_slotsisinf, which fails the response-schemaintegervalidation. That bug is already fixed onmainby #61140, which added a_sanitize_open_slotsvalidator (airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py) that mapsopen_slotsfrominfto-1onPoolResponse.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 serializeopen_slotsas-1and return200for unlimited pools.Testing
Two tests added (both seed
Pool(pool="unlimited_pool", slots=-1, include_deferred=False)):TestGetPool.test_get_unlimited_pool_should_respond_200—GET /pools/unlimited_poolreturns200and the response body serializes bothslotsandopen_slotsas-1(rather thaninf/ a 500).TestGetPools.test_get_pools_with_unlimited_pool_should_respond_200—GET /poolsreturns200and the unlimited pool in the collection hasslots == -1andopen_slots == -1, exercising the collection serializer.closes: #65377
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines