test: scope pagination checks to their fixtures (#7615)

Select Application Auto Scaling fixture IDs before pagination, assert both page identities, and exclude an interleaved target. Filter Resource Explorer by the created table ARN before checking its tags.

Port the pagination fixture changes from AndreKurait/floci#208 at 004988a7f4dc63cbcf48cde66abbb9b7a7ef1d85.

Signed-off-by: Andre Kurait <akurait@amazon.com>
Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Jackson PriceandAndre Kurait authored and GitHub committed 2026-11-05 13:53:05 -04:00
1 parent 2c49f5ecb5
commit d4a65d477b
2 files changed
+46 -22

No files matched your search

@@ -43,6 +43,7 @@ class ApplicationAutoScalingIntegrationTest {
private static final String ALARM_CLUSTER = "aas-it-cluster";
private static final String ALARM_SERVICE = "aas-it-alarm-service";
private static final String DIMENSION = "ecs:service:DesiredCount";
private static final String EXCLUDED_RESOURCE_ID = "service/aas-it-cluster/aas-it-service-excluded";
private static String scalableTargetArn;
@@ -144,20 +145,46 @@ class ApplicationAutoScalingIntegrationTest {
""".formatted(PAGED_RESOURCE_ID, DIMENSION))
.when().post("/").then().statusCode(200);
String nextToken = call("DescribeScalableTargets")
.body("{ \"ServiceNamespace\": \"ecs\", \"MaxResults\": 1 }")
.when().post("/")
.then().statusCode(200)
.body("ScalableTargets", hasSize(1))
.body("NextToken", notNullValue())
.extract().path("NextToken");
call("RegisterScalableTarget")
.body("""
{
"ServiceNamespace": "ecs",
"ResourceId": "%s",
"ScalableDimension": "%s",
"MinCapacity": 1,
"MaxCapacity": 2
}
""".formatted(EXCLUDED_RESOURCE_ID, DIMENSION))
.when().post("/").then().statusCode(200);
call("DescribeScalableTargets")
.body("{ \"ServiceNamespace\": \"ecs\", \"MaxResults\": 1, \"NextToken\": \"%s\" }"
.formatted(nextToken))
.when().post("/").then().statusCode(200)
.body("ScalableTargets", hasSize(1))
.body("NextToken", nullValue());
try {
String nextToken = call("DescribeScalableTargets")
.body("""
{ "ServiceNamespace": "ecs", "ResourceIds": ["%s", "%s"], "MaxResults": 1 }
""".formatted(RESOURCE_ID, PAGED_RESOURCE_ID))
.when().post("/")
.then().statusCode(200)
.body("ScalableTargets", hasSize(1))
.body("NextToken", notNullValue())
.body("ScalableTargets[0].ResourceId", equalTo(RESOURCE_ID))
.extract().path("NextToken");
call("DescribeScalableTargets")
.body("""
{ "ServiceNamespace": "ecs", "ResourceIds": ["%s", "%s"],
"MaxResults": 1, "NextToken": "%s" }
""".formatted(RESOURCE_ID, PAGED_RESOURCE_ID, nextToken))
.when().post("/").then().statusCode(200)
.body("ScalableTargets", hasSize(1))
.body("ScalableTargets[0].ResourceId", equalTo(PAGED_RESOURCE_ID))
.body("NextToken", nullValue());
} finally {
call("DeregisterScalableTarget")
.body("""
{ "ServiceNamespace": "ecs", "ResourceId": "%s", "ScalableDimension": "%s" }
""".formatted(EXCLUDED_RESOURCE_ID, DIMENSION))
.when().post("/").then().statusCode(200);
}
}
@Test
@@ -47,6 +47,7 @@ class ResourceExplorer2IntegrationTest {
private static final String BOUNDED_SCOPE = "service:s3,dynamodb";
private static boolean fixturesProvisioned = false;
private static String fixtureTableArn;
private record IndexRef(String auth, String arn) {}
@@ -103,7 +104,7 @@ class ResourceExplorer2IntegrationTest {
.statusCode(200);
// Create DynamoDB table with tags used by ListResources, DataProvenance, and FilterSemantics groups
given()
fixtureTableArn = given()
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
.contentType(DYNAMO_TYPE)
.body("""
@@ -119,7 +120,8 @@ class ResourceExplorer2IntegrationTest {
.post("/")
.then()
.statusCode(200)
.body("TableDescription.TableName", equalTo("re2-test-table"));
.body("TableDescription.TableName", equalTo("re2-test-table"))
.extract().path("TableDescription.TableArn");
// Lambda function (Resource Explorer 2 provider coverage)
given()
@@ -986,17 +988,12 @@ class ResourceExplorer2IntegrationTest {
@Test
void propertiesPopulatedWhenViewIncludesTags() {
// Target the known-tagged fixture table by ARN. A positional Resources[0] is
// unsafe: the full test suite shares one emulator instance, so other classes'
// untagged DynamoDB tables land in this same service:dynamodb result set and any
// of them may sort ahead of the tagged fixture.
// Filter before pagination so unrelated tables cannot push the fixture off the first page.
String table = "Resources.find { it.Arn.contains('re2-test-table') }";
given()
.header("Authorization", AUTH)
.contentType("application/json")
.body("""
{"Filters": {"FilterString": "service:dynamodb"}}
""")
.body(Map.of("Filters", Map.of("FilterString", "id:" + fixtureTableArn)))
.when()
.post("/ListResources")
.then()