fix(kinesis): cap ListShards page size at 1000 (#8387)

This commit is contained in:
Mahmoud Khalifa authored and GitHub committed 2026-11-15 10:50:12 -04:00
1 parent 92a61c2b86
commit 4fc41cc683
2 files changed
+25 -1

No files matched your search

@@ -2305,6 +2305,27 @@ class KinesisJsonHandlerTest {
}
}
@Test
void listShardsCapsPageAt1000EvenWhenMaxResultsIsLarger() {
createStream("test-stream", 1001);
ObjectNode first = MAPPER.createObjectNode();
first.put("StreamName", "test-stream");
first.put("MaxResults", 10000);
ObjectNode firstPage = responseEntity(handler.handle("ListShards", first, REGION));
assertEquals(1000, firstPage.get("Shards").size());
assertTrue(firstPage.hasNonNull("NextToken"), "a token is returned for the remaining shard");
ObjectNode second = MAPPER.createObjectNode();
second.put("NextToken", firstPage.get("NextToken").asText());
second.put("MaxResults", 10000);
ObjectNode secondPage = responseEntity(handler.handle("ListShards", second, REGION));
assertEquals(1, secondPage.get("Shards").size());
assertFalse(secondPage.hasNonNull("NextToken"));
}
@Test
void listShardsRejectsStreamNameTogetherWithNextToken() {
createStream("test-stream", 3);