Add regression tests for pools API with unlimited (-1) slots#68773
Conversation
|
Thanks @pierrejeambrun for the review on #68148. I opened this follow-up because GitHub would not let me reopen the original PR after I updated the branch. I think the referenced coverage from #65466 does not cover this path: that test is for the legacy Connexion API on I also added datamodel-level coverage for Local validation passed:
|
Accidentally approved - will be approved once datamodels/test_pools.py is removed.
|
@Vamsi-klu thanks for the PR, yes I got confused by the other PR targetting 2.x, thanks |
Follow-up to #68148, which was closed as already covered by #65466. I was not able to reopen #68148 via the GitHub CLI/API after updating the branch, so I am opening this from the same rebased branch with the gap called out explicitly.
The referenced coverage does not apply to this PR's target:
v2-11-test/ Airflow 2.11 maintenance code.tests/api_connexion/schemas/test_pool_schemas.py::test_serialize.main/ Airflow 3.x FastAPI core API routes.api_connexionis not present onmain; the relevant production path is_sanitize_open_slotsinairflow.api_fastapi.core_api.datamodels.pools, used byPoolResponseandPoolCollectionResponse.On
main, the existing unlimited-slots coverage only exercises the POST/create path (TestPostPool.test_post_pool_allows_unlimited_slots). It does not seed a pre-existingslots=-1DB row and read it back through the GET routes, which is the read-path regression from #65377.This test-only PR adds:
GET /pools/{name}regression coverage for an unlimited pool returningopen_slots == -1instead of 500.GET /poolsregression coverage forPoolCollectionResponsecontaining an unlimited pool._sanitize_open_slots(float("inf")) == -1andPoolResponseserialization of a busy unlimited pool with nonzero occupied/running/queued slots.The list test remains self-seeding and does not touch the shared
create_pools()helper, so the existing parametrized list counts/order assertions stay unchanged.No newsfragment: test-only change.
Local validation:
ruff check airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py airflow-core/tests/unit/api_fastapi/core_api/datamodels/test_pools.py-> passedPYTHONPATH="$PWD/airflow-core/src:$PWD/task-sdk/src:$PWD/airflow-core/tests" /Users/nalam/airflow-1/.venv/bin/python -m pytest airflow-core/tests/unit/api_fastapi/core_api/datamodels/test_pools.py -q-> 2 passedPYTHONPATH="$PWD/airflow-core/src:$PWD/task-sdk/src:$PWD/airflow-core/tests" /Users/nalam/airflow-1/.venv/bin/python -m pytest --with-db-init airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py::TestGetPool::test_get_unlimited_pool_should_respond_200 airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py::TestGetPools::test_get_pools_with_unlimited_pool_should_respond_200 -q-> 2 passed