Kinesis: honour NextToken/MaxResults in list_stream_consumers - #10161
Open
UTKARSH698 wants to merge 1 commit into
Open
Kinesis: honour NextToken/MaxResults in list_stream_consumers#10161UTKARSH698 wants to merge 1 commit into
UTKARSH698 wants to merge 1 commit into
Conversation
ListStreamConsumers declares NextToken/MaxResults as input and NextToken as output, but moto read neither and returned every consumer in a single response, so paginating clients looped or silently saw a full list. Wire it through the module's existing @paginate helper, the same way list_shards already does.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10161 +/- ##
==========================================
- Coverage 93.24% 93.24% -0.01%
==========================================
Files 1326 1326
Lines 121003 121006 +3
==========================================
Hits 112832 112832
- Misses 8171 8174 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
ListStreamConsumersdeclaresNextTokenandMaxResultsas input members andNextTokenas an output member:moto read neither input parameter and never emitted
NextToken--list_stream_consumersreturned every consumer in a single response and carried aPagination is not yet implementeddocstring. Clients that page explicitly either loop forever on an unchanging token or silently receive the full list when they asked for a bounded page.Fix
Wires the operation through the module's existing
@paginate(PAGINATION_MODEL)helper, exactly aslist_shardsalready does in the same files:moto/kinesis/utils.py-- newPAGINATION_MODELentry,unique_attributeisconsumer_arn(already unique per consumer)moto/kinesis/models.py--@paginatedecorator, and the now-inaccurate docstring removedmoto/kinesis/responses.py-- readsNextToken/MaxResultsand returns the tokenlimit_defaultis10000, matching bothlist_shardsand the botocoreMaxResultsmax, so a caller that passes noMaxResultsgets the same full list as before -- no behaviour change for existing users.Verification
Against a real boto3 client, 5 consumers at
MaxResults=2:The last page correctly omits
NextToken(moto emitsnulland botocore drops JSON nulls), so botocore's own paginator terminates.Test added to the existing
tests/test_kinesis/test_kinesis_stream_consumers.py, including the no-MaxResultsback-compat assertion.tests/test_kinesis/: 81 passed; the 4 failures are pre-existingopenapi_spec_validatorimport errors intest_kinesis_cloudformation.py, unrelated to this change.ruff check,ruff format --checkandmypy moto/kinesis/all clean. Thedocs/stanza is updated to match the removed docstring.