Add regression tests for pools API with unlimited (-1) slots#68148
Open
Vamsi-klu wants to merge 2 commits into
Open
Add regression tests for pools API with unlimited (-1) slots#68148Vamsi-klu wants to merge 2 commits into
Vamsi-klu wants to merge 2 commits into
Conversation
Contributor
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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