test(apigateway): cover every pageById collection in the page cap test (#9752)

ApiGatewayPageCapTest now also checks the 500-item cap on GetModels,
GetDocumentationParts and GetBasePathMappings, so collections() lists
every collection that pages through pageById.
This commit is contained in:
Matheus André authored and GitHub committed 2026-11-29 12:26:50 -04:00
1 parent 679c60cfb9
commit da01dd282d
1 file changed
+32
@@ -111,6 +111,35 @@ class ApiGatewayPageCapTest {
return (limit, position) -> service.getRequestValidatorPage(REGION, apiId, limit, position);
}
private static Pager models(ApiGatewayService service) {
String apiId = newApi(service);
for (int i = 0; service.getModels(REGION, apiId).size() < ITEMS; i++) {
service.createModel(REGION, apiId, Map.of("name", "capped" + i));
}
return (limit, position) -> service.getModelPage(REGION, apiId, limit, position);
}
private static Pager documentationParts(ApiGatewayService service) {
String apiId = newApi(service);
for (int i = 0; i < ITEMS; i++) {
service.createDocumentationPart(REGION, apiId, Map.of(
"location", Map.of("type", "MODEL", "name", "capped" + i), "properties", "{}"));
}
return (limit, position) ->
service.getDocumentationParts(REGION, apiId, null, null, null, null, limit, position);
}
private static Pager basePathMappings(ApiGatewayService service) {
String apiId = newApi(service);
String domainName = "capped.example.com";
service.createDomainName(REGION, Map.of("domainName", domainName, "endpointType", "REGIONAL"));
for (int i = 0; i < ITEMS; i++) {
service.createBasePathMapping(REGION, domainName, Map.of("basePath", "capped-" + i, "restApiId", apiId));
}
return (limit, position) ->
service.getBasePathMappingsPage(REGION, domainName, String.valueOf(limit), position);
}
private static Pager vpcLinks(ApiGatewayService service) {
for (int i = 0; i < ITEMS; i++) {
service.createVpcLink(REGION, Map.of("name", "capped-" + i,
@@ -129,6 +158,9 @@ class ApiGatewayPageCapTest {
Named.of("GetUsagePlans", ApiGatewayPageCapTest::usagePlans),
Named.of("GetUsagePlanKeys", ApiGatewayPageCapTest::usagePlanKeys),
Named.of("GetRequestValidators", ApiGatewayPageCapTest::requestValidators),
Named.of("GetModels", ApiGatewayPageCapTest::models),
Named.of("GetDocumentationParts", ApiGatewayPageCapTest::documentationParts),
Named.of("GetBasePathMappings", ApiGatewayPageCapTest::basePathMappings),
Named.of("GetVpcLinks", ApiGatewayPageCapTest::vpcLinks));
}