[ContainerApp] Fix #31762: az containerapp job list: Fix bug only 20 items are returned#31888
[ContainerApp] Fix #31762: az containerapp job list: Fix bug only 20 items are returned#31888zhoxing-ms merged 2 commits intoAzure:devfrom
az containerapp job list: Fix bug only 20 items are returned#31888Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a pagination bug in the az containerapp job list command where only the first 20 items were being returned instead of all available container app jobs. The fix implements proper handling of paginated API responses by following nextLink tokens to retrieve all pages of results.
- Adds pagination handling to both subscription-level and resource group-level job listing methods
- Includes a comprehensive test that creates 30 jobs to verify the pagination fix works correctly
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
_clients.py |
Implements pagination logic in list_by_subscription and list_by_resource_group methods to handle nextLink responses |
test_containerappjob_crud.py |
Adds test case that creates 30 jobs and verifies all are returned by the list command |
|
|
||
| # get list of Container App Jobs | ||
| jobs_list = self.cmd("az containerapp job list --resource-group {}".format(resource_group)).get_output_in_json() | ||
| self.assertTrue(len(jobs_list) == 30) |
There was a problem hiding this comment.
Use self.assertEqual(len(jobs_list), 30) instead of self.assertTrue for better error messages when the assertion fails. This will show the actual vs expected count in test failures.
| self.assertTrue(len(jobs_list) == 30) | |
| self.assertEqual(len(jobs_list), 30) |
az containerapp job list: Fix bug only 20 items are returnedaz containerapp job list: Fix bug only 20 items are returned
Related command
az containerapp job listDescription
Fix #31762
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.