Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

test(compat): build partition-aware ARNs in the partition nightly's failing tests (#6451)

Hector Venturaafb4afd2f11f
diff --git a/.github/ci/compat-partition-allowlist-eusc-de-east-1.txt b/.github/ci/compat-partition-allowlist-eusc-de-east-1.txt
index 9027162655..134753200e 100644
--- a/.github/ci/compat-partition-allowlist-eusc-de-east-1.txt
+++ b/.github/ci/compat-partition-allowlist-eusc-de-east-1.txt
@@ -4,3 +4,8 @@
# missing from this list, or an entry that no longer fails, fails the run. Delete an entry
# as soon as its test passes. Measured 2026-10-13 on main 367ae0b2d, JVM image; failures
# that also occur in the commercial control run are environmental and not listed.
+
+# The Resource Groups model cannot name an EUSC resource: GroupStringV2 and ResourceArn both
+# require the region to be `[a-z]{2}(-[a-z]+)+-\d`, which `eusc-de-east-1` never matches, so
+# GroupResources rejects the capacity reservation's own ARN. Floci enforces the model as published.
+ResourceGroupsTest#capacityPoolLifecycle
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
index c8eb70c99c..3a1689368c 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
@@ -65,7 +65,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
class ApiGatewayV2WebSocketDataPlaneTest {
private static final ObjectMapper JSON = new ObjectMapper();
- private static final String ROLE = "arn:aws:iam::000000000000:role/lambda-role";
+ private static final String ROLE = TestFixtures.globalArn("iam", "000000000000", "role/lambda-role");
private static final String STAGE = "test";
private static ApiGatewayV2Client gw;
@@ -218,7 +218,7 @@ class ApiGatewayV2WebSocketDataPlaneTest {
CreateIntegrationResponse res = gw.createIntegration(CreateIntegrationRequest.builder()
.apiId(apiId)
.integrationType(IntegrationType.AWS_PROXY)
- .integrationUri("arn:aws:lambda:us-east-1:000000000000:function:" + fnName)
+ .integrationUri(TestFixtures.arn("lambda", "000000000000", "function:" + fnName))
.build());
return res.integrationId();
}
@@ -250,7 +250,7 @@ class ApiGatewayV2WebSocketDataPlaneTest {
URI mgmtEndpoint = URI.create(TestFixtures.endpoint() + "/execute-api/" + apiId + "/" + STAGE);
return ApiGatewayManagementApiClient.builder()
.endpointOverride(mgmtEndpoint)
- .region(software.amazon.awssdk.regions.Region.US_EAST_1)
+ .region(TestFixtures.region())
.credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
.build();
@@ -386,7 +386,7 @@ class ApiGatewayV2WebSocketDataPlaneTest {
.apiId(apiId)
.authorizerType(AuthorizerType.REQUEST)
.name("ws-auth")
- .authorizerUri("arn:aws:lambda:us-east-1:000000000000:function:" + authFn)
+ .authorizerUri(TestFixtures.arn("lambda", "000000000000", "function:" + authFn))
.identitySource("route.request.querystring.token")
.build());
@@ -543,7 +543,7 @@ class ApiGatewayV2WebSocketDataPlaneTest {
CreateIntegrationResponse integRes = gw.createIntegration(CreateIntegrationRequest.builder()
.apiId(apiId)
.integrationType(IntegrationType.AWS_PROXY)
- .integrationUri("arn:aws:lambda:us-east-1:000000000000:function:${stageVariables.functionName}")
+ .integrationUri(TestFixtures.arn("lambda", "000000000000", "function:${stageVariables.functionName}"))
.build());
String integId = integRes.integrationId();
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2TagRegionTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2TagRegionTest.java
index 0f22009537..79ff9100ae 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2TagRegionTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2TagRegionTest.java
@@ -1,5 +1,6 @@
package com.floci.test;
+import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
@@ -16,6 +17,7 @@ import software.amazon.awssdk.services.ec2.model.Tag;
import software.amazon.awssdk.services.ec2.model.TagDescription;
import java.util.List;
+import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
@@ -25,7 +27,9 @@ class Ec2TagRegionTest {
@Test
@DisplayName("DescribeTags lists only the tags of resources in the client's region")
void describeTagsListsOnlyTheClientRegionsTags() {
- Region other = otherRegionInThePartition();
+ Optional<Region> second = otherRegionInThePartition();
+ Assumptions.assumeTrue(second.isPresent(), () -> "no second region in partition " + TestFixtures.partition());
+ Region other = second.get();
try (Ec2Client home = TestFixtures.ec2Client(); Ec2Client away = clientFor(other)) {
String homeVpc = home.createVpc(CreateVpcRequest.builder().cidrBlock("10.92.0.0/16").build()).vpc().vpcId();
String awayVpc = away.createVpc(CreateVpcRequest.builder().cidrBlock("10.93.0.0/16").build()).vpc().vpcId();
@@ -50,7 +54,7 @@ class Ec2TagRegionTest {
.tags().stream().map(TagDescription::resourceId).toList();
}
- private static Region otherRegionInThePartition() {
+ private static Optional<Region> otherRegionInThePartition() {
Region home = TestFixtures.region();
String partition = TestFixtures.partition();
return Region.regions().stream()
@@ -60,8 +64,7 @@ class Ec2TagRegionTest {
return metadata != null && partition.equals(metadata.partition().id());
})
.sorted((a, b) -> a.id().compareTo(b.id()))
- .findFirst()
- .orElseThrow(() -> new AssertionError("no second region in partition " + partition));
+ .findFirst();
}
private static Ec2Client clientFor(Region region) {
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EmrServerlessJobRunTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EmrServerlessJobRunTest.java
index 56c1ab4575..553b6ea916 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EmrServerlessJobRunTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EmrServerlessJobRunTest.java
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
@DisplayName("EMR Serverless job runs")
class EmrServerlessJobRunTest {
- private static final String ROLE = "arn:aws:iam::000000000000:role/emr-serverless-job";
+ private static final String ROLE = TestFixtures.globalArn("iam", "000000000000", "role/emr-serverless-job");
private static EmrServerlessClient emr;
private static String applicationId;
@@ -91,7 +91,7 @@ class EmrServerlessJobRunTest {
assertThat(run.state()).isEqualTo(JobRunState.SUCCESS);
assertThat(run.executionRole()).isEqualTo(ROLE);
assertThat(run.releaseLabel()).isEqualTo("emr-7.5.0");
- assertThat(run.createdBy()).startsWith("arn:aws:");
+ assertThat(run.createdBy()).startsWith("arn:" + TestFixtures.partition() + ":");
assertThat(run.createdAt()).isBetween(before, after);
assertThat(run.jobDriver().sparkSubmit().entryPoint()).isEqualTo("s3://bucket/jobs/app.jar");
assertThat(run.tags()).containsEntry("team", "data");
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RedshiftOperationsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RedshiftOperationsTest.java
index 309677db71..cceb86a92c 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RedshiftOperationsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RedshiftOperationsTest.java
@@ -365,7 +365,7 @@ class RedshiftOperationsTest {
.masterUserPassword(PASSWORD)
.build());
clustersToCleanup.add(clusterId);
- String arn = "arn:aws:redshift:us-east-1:000000000000:cluster:" + clusterId;
+ String arn = TestFixtures.arn("redshift", "000000000000", "cluster:" + clusterId);
client.createTags(CreateTagsRequest.builder()
.resourceName(arn)
@@ -388,7 +388,7 @@ class RedshiftOperationsTest {
.build());
assertThat(modified.cluster().nodeType()).isEqualTo("ra3.xlplus");
- String roleArn = "arn:aws:iam::000000000000:role/rs-copy-role";
+ String roleArn = TestFixtures.globalArn("iam", "000000000000", "role/rs-copy-role");
ModifyClusterIamRolesResponse withRole = client.modifyClusterIamRoles(ModifyClusterIamRolesRequest.builder()
.clusterIdentifier(clusterId)
.addIamRoles(roleArn)