diff --git a/.github/ci/compat-partition-allowlist-cn-north-1.txt b/.github/ci/compat-partition-allowlist-cn-north-1.txt index 612deddc43..71b699b918 100644 --- a/.github/ci/compat-partition-allowlist-cn-north-1.txt +++ b/.github/ci/compat-partition-allowlist-cn-north-1.txt @@ -4,50 +4,3 @@ # 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-01 on main 231655b70 plus #4787, JVM image; # failures that also occur in the commercial control run are environmental and not listed. - -# The test pins commercial values: an ARN built as arn:aws::us-east-1:..., an -# expected arn:aws: prefix, a us-east-1 availability zone or host, or a client created with -# Region.US_EAST_1 next to the cn-north-1 fixture clients. Floci answers correctly; the -# test should take the partition and region from TestFixtures (region(), partition(), arn(), -# globalArn()). -AcmTest#testImportCertificate -AcmTest#testRequestCertificate -ApiGatewayOpenApiImportCompatibilityTest#sdkImportAndPutResolveAwsVariables -ApiGatewayV2ManagementTest#createApi -ApiGatewayV2WebSocketAndExtendedOpsTest#getTagsEmpty -ApiGatewayV2WebSocketAndExtendedOpsTest#tagging -AthenaTest#listTagsForResourceReturnsTagsSetOnCreation -CloudFormationAcmCertificateTest#certificateOptionsFollowTheTemplateThroughCreateAndUpdate -CloudFormationEventBusTest#createsValidatesUpdatesAndDeletesEventBusThroughAwsSdk -CloudFormationEventSourceMappingTest#createDynamoDbStreamStack_withRetryAndDestinationOptions -CloudFormationIamUserTest#createsValidatesUpdatesAndDeletesIamUserThroughAwsSdk -CloudFormationRedshiftClusterTest#provisionsRedshiftClusterAndConnectsViaJdbc -CloudHsmV2Test#testDeleteHsmSelectors -CloudHsmV2Test#testFullLifecycle -CloudTrailTest#describeTrailsByName -CloudWatchLogsCrossAccountPolicyTest#destinationAndAccountPolicyOperationsUseAwsSdk -CloudWatchLogsDescribeLogGroupsTest#returnsAwsLogGroupArnFields -CodeDeployTest#tagAndListTags -CodeDeployTest#untagResource -DmsTest#replicationSubnetGroupLifecycleUsesAwsSdkWireContract -EcrTest#createRepository -EksTest#fargateProfileLifecycle -GlueCatalogTest#createDatabaseWithTags_tagsReturnedByResourceGroupsTaggingApi -GuardDutyTest#detectorLifecycleUsesAwsSdkWireShapes -IotTest#domainConfigurationLifecycle -MacieOrganizationAdministrationTest#organizationAdministrationUsesAwsSdk -NeptuneTest#createCluster -NeptuneTest#createInstance -OrganizationsTest#testFullLifecycle -RdsIamTokenCompatTest#sdkGeneratedTokenIsAccepted -RdsJdbcCompatTest#connectWithIamAuthToken -RdsJdbcCompatTest#modifyKeepsProxyReachableAndDeleteReleasesPort -RdsJdbcCompatTest#toggleIamViaModifyOnRunningInstance -ResourceExplorer2Test#viewFiltersFilterStringDeserializes -Route53Test#crossAccountVpcAssociationLifecycleUsesAwsSdkWireContract -S3TablesTest#createsAndGetsTableBucket -S3VectorsTest#createIndex -S3VectorsTest#createVectorBucket -SecretsManagerTest#rotateSecretStub -SesEventPublishingTest# -SsoOidcTest#createTokenWithIamUsesAwsSdk diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java index 7bd4fa6c2f..8ee0f1211b 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java @@ -106,7 +106,7 @@ class AcmTest { arnsToCleanup.add(requestedCertArn); assertThat(requestedCertArn).isNotNull(); - assertThat(requestedCertArn).matches("arn:aws:acm:.*:.*:certificate/.*"); + assertThat(requestedCertArn).matches("arn:" + TestFixtures.partition() + ":acm:.*:.*:certificate/.*"); } @Test @@ -216,7 +216,7 @@ class AcmTest { arnsToCleanup.add(importedCertArn); assertThat(importedCertArn).isNotNull(); - assertThat(importedCertArn).matches("arn:aws:acm:.*:.*:certificate/.*"); + assertThat(importedCertArn).matches("arn:" + TestFixtures.partition() + ":acm:.*:.*:certificate/.*"); } @Test @@ -344,7 +344,7 @@ class AcmTest { @Order(40) @DisplayName("Describe a non-existent certificate throws exception") void testDescribeNonExistentCertificate() { - String fakeArn = "arn:aws:acm:us-east-1:000000000000:certificate/00000000-0000-0000-0000-000000000000"; + String fakeArn = TestFixtures.arn("acm", "000000000000", "certificate/00000000-0000-0000-0000-000000000000"); assertThatThrownBy(() -> acm.describeCertificate(b -> b .certificateArn(fakeArn))) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayOpenApiImportCompatibilityTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayOpenApiImportCompatibilityTest.java index 9b3f647dd2..54be27e265 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayOpenApiImportCompatibilityTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayOpenApiImportCompatibilityTest.java @@ -29,6 +29,7 @@ class ApiGatewayOpenApiImportCompatibilityTest { @DisplayName("ImportRestApi and PutRestApi resolve AWS variables through the SDK") void sdkImportAndPutResolveAwsVariables() { String title = TestFixtures.uniqueName("apigw-variable-import"); + String region = TestFixtures.region().id(); try (ApiGatewayClient apiGateway = TestFixtures.apiGatewayClient()) { ImportRestApiResponse imported = apiGateway.importRestApi(request -> request .body(SdkBytes.fromUtf8String(variableSpec(title, "${AWS::Region}")))); @@ -37,11 +38,11 @@ class ApiGatewayOpenApiImportCompatibilityTest { GetIntegrationResponse integration = apiGateway.getIntegration(request -> request .restApiId(imported.id()).resourceId(initialId).httpMethod("POST")); assertThat(integration.uri()) - .isEqualTo("arn:aws:apigateway:us-east-1:states:action/StartExecution"); + .isEqualTo(TestFixtures.arn("apigateway", "states", "action/StartExecution")); assertThat(integration.requestTemplates()) - .containsEntry("application/json", "{\"value\":\"us-east-1\"}"); + .containsEntry("application/json", "{\"value\":\"" + region + "\"}"); assertThat(integration.requestParameters()) - .containsEntry("integration.request.header.X-Region", "'us-east-1'"); + .containsEntry("integration.request.header.X-Region", "'" + region + "'"); assertThat(apiGateway.getGatewayResponse(request -> request .restApiId(imported.id()).responseType(GatewayResponseType.UNAUTHORIZED)) .responseTemplates()) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ManagementTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ManagementTest.java index ac4b1a29ed..31c149b55c 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ManagementTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ManagementTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import software.amazon.awssdk.regions.RegionMetadata; import software.amazon.awssdk.services.apigatewayv2.ApiGatewayV2Client; import software.amazon.awssdk.services.apigatewayv2.model.ApiGatewayV2Exception; import software.amazon.awssdk.services.apigatewayv2.model.AuthorizerType; @@ -74,6 +75,7 @@ class ApiGatewayV2ManagementTest { private static String routeId; private static String deploymentId; private static final String stageName = "test"; + private static final String HANDLER_ARN = TestFixtures.arn("lambda", "000000000000", "function:phase2-handler"); private static boolean stageCreated; @BeforeAll @@ -126,7 +128,10 @@ class ApiGatewayV2ManagementTest { assertThat(apiId).isNotBlank(); assertThat(response.name()).startsWith("http-api-"); assertThat(response.protocolType()).isEqualTo(ProtocolType.HTTP); - assertThat(response.apiEndpoint()).contains(apiId + ".execute-api.us-east-1.amazonaws.com"); + RegionMetadata metadata = TestFixtures.region().metadata(); + String dnsSuffix = metadata == null ? "amazonaws.com" : metadata.partition().dnsSuffix(); + assertThat(response.apiEndpoint()) + .contains(apiId + ".execute-api." + TestFixtures.region().id() + "." + dnsSuffix); assertThat(response.createdDate()).isNotNull(); } @@ -204,7 +209,7 @@ class ApiGatewayV2ManagementTest { CreateIntegrationResponse response = apigwv2.createIntegration(CreateIntegrationRequest.builder() .apiId(apiId) .integrationType(IntegrationType.AWS_PROXY) - .integrationUri("arn:aws:lambda:us-east-1:000000000000:function:phase2-handler") + .integrationUri(HANDLER_ARN) .payloadFormatVersion("2.0") .build()); @@ -212,7 +217,7 @@ class ApiGatewayV2ManagementTest { assertThat(integrationId).isNotBlank(); assertThat(response.integrationType()).isEqualTo(IntegrationType.AWS_PROXY); - assertThat(response.integrationUri()).isEqualTo("arn:aws:lambda:us-east-1:000000000000:function:phase2-handler"); + assertThat(response.integrationUri()).isEqualTo(HANDLER_ARN); assertThat(response.payloadFormatVersion()).isEqualTo("2.0"); } diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketAndExtendedOpsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketAndExtendedOpsTest.java index ed2937ac01..59cfef31a5 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketAndExtendedOpsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketAndExtendedOpsTest.java @@ -437,7 +437,7 @@ class ApiGatewayV2WebSocketAndExtendedOpsTest { .tags(Map.of("initial", "tag")) .build()); String tagApiId = createRes.apiId(); - String arn = "arn:aws:apigateway:us-east-1::/apis/" + tagApiId; + String arn = TestFixtures.arn("apigateway", "", "/apis/" + tagApiId); try { // Verify tags on create @@ -478,7 +478,7 @@ class ApiGatewayV2WebSocketAndExtendedOpsTest { .protocolType(ProtocolType.HTTP) .build()); String noTagApiId = createRes.apiId(); - String arn = "arn:aws:apigateway:us-east-1::/apis/" + noTagApiId; + String arn = TestFixtures.arn("apigateway", "", "/apis/" + noTagApiId); try { Map tags = gw.getTags(GetTagsRequest.builder().resourceArn(arn).build()).tags(); @@ -492,7 +492,7 @@ class ApiGatewayV2WebSocketAndExtendedOpsTest { @DisplayName("TagResource on non-existent API returns 404") void tagResourceNotFound() { assertThatThrownBy(() -> gw.tagResource(TagResourceRequest.builder() - .resourceArn("arn:aws:apigateway:us-east-1::/apis/nonexistent999") + .resourceArn(TestFixtures.arn("apigateway", "", "/apis/nonexistent999")) .tags(Map.of("k", "v")) .build())) .isInstanceOf(NotFoundException.class); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AthenaTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AthenaTest.java index 223f8cbf98..e420903ec6 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AthenaTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AthenaTest.java @@ -345,7 +345,7 @@ class AthenaTest { ListTagsForResourceResponse response = athena.listTagsForResource( ListTagsForResourceRequest.builder() - .resourceARN("arn:aws:athena:us-east-1:000000000000:workgroup/" + groupName) + .resourceARN(TestFixtures.arn("athena", "000000000000", "workgroup/" + groupName)) .build()); assertThat(response.tags()).hasSize(1); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationAcmCertificateTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationAcmCertificateTest.java index 313525fdcb..9216d3d252 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationAcmCertificateTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationAcmCertificateTest.java @@ -68,7 +68,7 @@ class CloudFormationAcmCertificateTest { assertThat(waitForTerminal(stackName, 60)).isEqualTo("CREATE_COMPLETE"); String arn = output("CertArn"); - assertThat(arn).startsWith("arn:aws:acm:us-east-1:"); + assertThat(arn).startsWith("arn:" + TestFixtures.partition() + ":acm:" + TestFixtures.region().id() + ":"); CertificateDetail created = describe(arn); assertThat(created.domainName()).isEqualTo(domainName); assertThat(created.status()).isEqualTo(CertificateStatus.ISSUED); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java index e9e9e8ce19..769d60578a 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java @@ -69,7 +69,7 @@ class CloudFormationEventBusTest { .stacks().get(0); Map outputs = createdStack.outputs().stream() .collect(Collectors.toMap(Output::outputKey, Output::outputValue)); - String busArn = "arn:aws:events:us-east-1:000000000000:event-bus/" + busName; + String busArn = TestFixtures.arn("events", "000000000000", "event-bus/" + busName); assertThat(outputs) .containsEntry("BusRef", busName) .containsEntry("BusName", busName) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java index 57a256e155..16f66f57b2 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java @@ -25,9 +25,8 @@ class CloudFormationEventSourceMappingTest { private static final String STACK_NAME = "compat-cfn-esm-stack"; private static final String FUNC_NAME = "compat-cfn-esm-func"; private static final String QUEUE_NAME = "compat-cfn-esm-queue"; - private static final String ROLE = "arn:aws:iam::000000000000:role/cfn-lambda-role"; + private static final String ROLE = TestFixtures.globalArn("iam", "000000000000", "role/cfn-lambda-role"); private static final String ACCOUNT = "000000000000"; - private static final String REGION = "us-east-1"; private static final String DDB_STACK_NAME = "compat-cfn-esm-ddb-stack"; private static final String DDB_FUNC_NAME = "compat-cfn-esm-ddb-func"; @@ -186,7 +185,7 @@ class CloudFormationEventSourceMappingTest { assertThat(esm.bisectBatchOnFunctionError()).isTrue(); assertThat(esm.destinationConfig()).isNotNull(); assertThat(esm.destinationConfig().onFailure().destination()) - .isEqualTo("arn:aws:sqs:" + REGION + ":" + ACCOUNT + ":" + DLQ_NAME); + .isEqualTo(TestFixtures.arn("sqs", ACCOUNT, DLQ_NAME)); } @Test diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationIamUserTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationIamUserTest.java index 0170a69a39..a4c8ed36bc 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationIamUserTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationIamUserTest.java @@ -84,7 +84,8 @@ class CloudFormationIamUserTest { assertThat(outputs).containsEntry("UserRef", userName); String userArn = outputs.get("UserArn"); - assertThat(userArn).startsWith("arn:aws:iam::").endsWith(":user/initial/" + userName); + assertThat(userArn).startsWith("arn:" + TestFixtures.partition() + ":iam::") + .endsWith(":user/initial/" + userName); GetUserResponse userResponse = iam.getUser(GetUserRequest.builder().userName(userName).build()); User user = userResponse.user(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationRedshiftClusterTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationRedshiftClusterTest.java index 442262ca3b..4f47075bb0 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationRedshiftClusterTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationRedshiftClusterTest.java @@ -110,7 +110,7 @@ class CloudFormationRedshiftClusterTest { assertThat(portStr).isNotBlank(); int port = Integer.parseInt(portStr); assertThat(port).isPositive(); - assertThat(ns).startsWith("arn:aws:redshift:"); + assertThat(ns).startsWith("arn:" + TestFixtures.partition() + ":redshift:"); String connectHost = "host.docker.internal".equalsIgnoreCase(addr) ? TestFixtures.proxyHost() diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java index 8b039ffe37..b100ca29bb 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java @@ -67,7 +67,7 @@ public class CloudHsmV2Test { // 3. Create HSM CreateHsmResponse hsmResp = client.createHsm(r -> r .clusterId(clusterId) - .availabilityZone("us-east-1a") + .availabilityZone(TestFixtures.region().id() + "a") .ipAddress("10.0.1.5") ); @@ -128,7 +128,8 @@ public class CloudHsmV2Test { client.initializeCluster(r -> r.clusterId(clusterId).signedCert(signedCert).trustAnchor(trustAnchor)); - Hsm hsm = client.createHsm(r -> r.clusterId(clusterId).availabilityZone("us-east-1b")).hsm(); + Hsm hsm = client.createHsm(r -> r.clusterId(clusterId) + .availabilityZone(TestFixtures.region().id() + "b")).hsm(); // Test exactly one selector rule assertThatThrownBy(() -> client.deleteHsm(r -> r diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudTrailTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudTrailTest.java index bf78cc19e5..fb5b74bf0b 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudTrailTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudTrailTest.java @@ -63,7 +63,7 @@ class CloudTrailTest { assertThat(response.trailList()).hasSize(1); Trail trail = response.trailList().get(0); assertThat(trail.name()).isEqualTo(trailName); - assertThat(trail.homeRegion()).isEqualTo("us-east-1"); + assertThat(trail.homeRegion()).isEqualTo(TestFixtures.region().id()); assertThat(trail.s3BucketName()).isEqualTo(bucketName); } diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsCrossAccountPolicyTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsCrossAccountPolicyTest.java index c9f0d87b36..dd8b936d0f 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsCrossAccountPolicyTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsCrossAccountPolicyTest.java @@ -26,12 +26,12 @@ class CloudWatchLogsCrossAccountPolicyTest { try (CloudWatchLogsClient logs = TestFixtures.cloudWatchLogsClient()) { PutDestinationResponse putDestination = logs.putDestination(request -> request .destinationName(DESTINATION_NAME) - .targetArn("arn:aws:kinesis:us-east-1:000000000000:stream/floci-sdk-logs") - .roleArn("arn:aws:iam::000000000000:role/floci-sdk-logs")); + .targetArn(TestFixtures.arn("kinesis", "000000000000", "stream/floci-sdk-logs")) + .roleArn(TestFixtures.globalArn("iam", "000000000000", "role/floci-sdk-logs"))); assertThat(putDestination.destination()).isNotNull(); assertThat(putDestination.destination().destinationName()).isEqualTo(DESTINATION_NAME); - assertThat(putDestination.destination().arn()).contains(":logs:us-east-1:"); + assertThat(putDestination.destination().arn()).contains(":logs:" + TestFixtures.region().id() + ":"); logs.putDestinationPolicy(request -> request .destinationName(DESTINATION_NAME) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsDescribeLogGroupsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsDescribeLogGroupsTest.java index bfa81dbc93..0857834c53 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsDescribeLogGroupsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudWatchLogsDescribeLogGroupsTest.java @@ -22,9 +22,9 @@ class CloudWatchLogsDescribeLogGroupsTest { LogGroup group = findGroup(logs, groupName); assertThat(group.arn()) - .isEqualTo("arn:aws:logs:us-east-1:000000000000:log-group:" + groupName + ":*"); + .isEqualTo(TestFixtures.arn("logs", "000000000000", "log-group:" + groupName + ":*")); assertThat(group.logGroupArn()) - .isEqualTo("arn:aws:logs:us-east-1:000000000000:log-group:" + groupName); + .isEqualTo(TestFixtures.arn("logs", "000000000000", "log-group:" + groupName)); assertThat(group.logGroupArn()).doesNotEndWith(":*"); } finally { deleteIfPresent(logs, groupName); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java index badece0426..d23d9138e2 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java @@ -63,7 +63,7 @@ class CodeDeployTest { static final String DEPLOY_FUNCTION = "cd-deploy-fn"; static final String DEPLOY_ALIAS = "live"; - static final String ROLE = "arn:aws:iam::000000000000:role/lambda-role"; + static final String ROLE = TestFixtures.globalArn("iam", "000000000000", "role/lambda-role"); static String deploymentId; static String v1; static String v2; @@ -163,7 +163,7 @@ class CodeDeployTest { .applicationName("sdk-lambda-app") .deploymentGroupName("sdk-lambda-dg") .deploymentConfigName("CodeDeployDefault.LambdaAllAtOnce") - .serviceRoleArn("arn:aws:iam::000000000000:role/codedeploy-role") + .serviceRoleArn(TestFixtures.globalArn("iam", "000000000000", "role/codedeploy-role")) .deploymentStyle(DeploymentStyle.builder() .deploymentType(DeploymentType.BLUE_GREEN) .deploymentOption(DeploymentOption.WITH_TRAFFIC_CONTROL) @@ -236,7 +236,7 @@ class CodeDeployTest { @Test @Order(14) void tagAndListTags() { - String arn = "arn:aws:codedeploy:us-east-1:000000000000:application:sdk-lambda-app"; + String arn = TestFixtures.arn("codedeploy", "000000000000", "application:sdk-lambda-app"); codedeploy.tagResource(r -> r .resourceArn(arn) .tags(Tag.builder().key("team").value("platform").build(), @@ -250,7 +250,7 @@ class CodeDeployTest { @Test @Order(15) void untagResource() { - String arn = "arn:aws:codedeploy:us-east-1:000000000000:application:sdk-lambda-app"; + String arn = TestFixtures.arn("codedeploy", "000000000000", "application:sdk-lambda-app"); codedeploy.untagResource(r -> r.resourceArn(arn).tagKeys("project")); ListTagsForResourceResponse resp = codedeploy.listTagsForResource(r -> r.resourceArn(arn)); @@ -331,7 +331,7 @@ class CodeDeployTest { .applicationName("cd-lambda-app") .deploymentGroupName("cd-lambda-dg") .deploymentConfigName("CodeDeployDefault.LambdaAllAtOnce") - .serviceRoleArn("arn:aws:iam::000000000000:role/codedeploy-role")); + .serviceRoleArn(TestFixtures.globalArn("iam", "000000000000", "role/codedeploy-role"))); } @Test diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DmsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DmsTest.java index 0377d0ac84..7042062813 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DmsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DmsTest.java @@ -51,7 +51,7 @@ class DmsTest { assertFalse(group.subnets().isEmpty()); assertTrue(group.subnets().stream() .allMatch(subnet -> "Active".equals(subnet.subnetStatus()))); - String arn = "arn:aws:dms:us-east-1:" + callerAccountId() + ":subgrp:" + GROUP_ID; + String arn = TestFixtures.arn("dms", callerAccountId(), "subgrp:" + GROUP_ID); assertEquals(Map.of("env", "test"), tagsOf(dms, arn)); dms.addTagsToResource(request -> request.resourceArn(arn) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcrTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcrTest.java index fd3fd0ea8a..c16c37094b 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcrTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcrTest.java @@ -52,7 +52,7 @@ class EcrTest { Repository repo = resp.repository(); assertThat(repo.repositoryName()).isEqualTo(REPO_NAME); - assertThat(repo.repositoryArn()).startsWith("arn:aws:ecr:"); + assertThat(repo.repositoryArn()).startsWith("arn:" + TestFixtures.partition() + ":ecr:"); assertThat(repo.repositoryArn()).contains(":repository/" + REPO_NAME); assertThat(repo.repositoryUri()).contains("/" + REPO_NAME); // Hostname must resolve to loopback so docker auto-trusts it as insecure. @@ -209,7 +209,7 @@ class EcrTest { .containsExactly(firstPrefix); String credentialArn = - "arn:aws:secretsmanager:us-east-1:000000000000:secret:ecr-pullthroughcache/sdk"; + TestFixtures.arn("secretsmanager", "000000000000", "secret:ecr-pullthroughcache/sdk"); UpdatePullThroughCacheRuleResponse updated = ecr.updatePullThroughCacheRule(builder -> builder .ecrRepositoryPrefix(firstPrefix) .credentialArn(credentialArn)); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EksTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EksTest.java index 7bac5ecd25..a340bc34f1 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EksTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EksTest.java @@ -60,7 +60,7 @@ class EksTest { void createCluster() { CreateClusterResponse response = eks.createCluster(CreateClusterRequest.builder() .name(clusterName) - .roleArn("arn:aws:iam::000000000000:role/eks-role") + .roleArn(TestFixtures.globalArn("iam", "000000000000", "role/eks-role")) .resourcesVpcConfig(VpcConfigRequest.builder() .subnetIds(List.of()) .securityGroupIds(List.of()) @@ -153,7 +153,7 @@ class EksTest { void createDuplicateClusterFails() { assertThatThrownBy(() -> eks.createCluster(CreateClusterRequest.builder() .name(clusterName) - .roleArn("arn:aws:iam::000000000000:role/eks-role") + .roleArn(TestFixtures.globalArn("iam", "000000000000", "role/eks-role")) .resourcesVpcConfig(VpcConfigRequest.builder().build()) .build())) .isInstanceOf(ResourceInUseException.class); @@ -170,7 +170,7 @@ class EksTest { .clusterName(clusterName) .nodegroupName(NODEGROUP) .subnets("subnet-abc") - .nodeRole("arn:aws:iam::000000000000:role/eks-node-role") + .nodeRole(TestFixtures.globalArn("iam", "000000000000", "role/eks-node-role")) .scalingConfig(NodegroupScalingConfig.builder() .minSize(1).maxSize(3).desiredSize(2).build()) .build()); @@ -225,7 +225,7 @@ class EksTest { CreateNodegroupResponse createResponse = eks.createNodegroup(CreateNodegroupRequest.builder() .clusterName(clusterName) .nodegroupName(nodegroupName) - .nodeRole("arn:aws:iam::000000000000:role/eks-node-role") + .nodeRole(TestFixtures.globalArn("iam", "000000000000", "role/eks-node-role")) .subnets("subnet-12345678", "subnet-87654321") .scalingConfig(NodegroupScalingConfig.builder() .minSize(1) @@ -279,7 +279,7 @@ class EksTest { CreateFargateProfileResponse createResponse = eks.createFargateProfile(CreateFargateProfileRequest.builder() .clusterName(clusterName) .fargateProfileName(fargateProfileName) - .podExecutionRoleArn("arn:aws:iam::000000000000:role/eks-fargate-role") + .podExecutionRoleArn(TestFixtures.globalArn("iam", "000000000000", "role/eks-fargate-role")) .subnets("subnet-12345678", "subnet-87654321") .selectors(FargateProfileSelector.builder() .namespace("default") @@ -292,7 +292,8 @@ class EksTest { assertThat(createResponse.fargateProfile().clusterName()).isEqualTo(clusterName); assertThat(createResponse.fargateProfile().fargateProfileName()).isEqualTo(fargateProfileName); assertThat(createResponse.fargateProfile().fargateProfileArn()) - .matches("arn:aws:eks:[^:]+:[0-9]+:fargateprofile/" + clusterName + "/" + fargateProfileName + "/.+"); + .matches("arn:" + TestFixtures.partition() + ":eks:[^:]+:[0-9]+:fargateprofile/" + + clusterName + "/" + fargateProfileName + "/.+"); assertThat(createResponse.fargateProfile().status()).isEqualTo(FargateProfileStatus.ACTIVE); assertThat(createResponse.fargateProfile().selectors()).hasSize(1); assertThat(createResponse.fargateProfile().selectors().get(0).labels()).containsEntry("app", "api"); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueCatalogTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueCatalogTest.java index 9f02e3172a..a8c3ad1ae1 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueCatalogTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueCatalogTest.java @@ -559,7 +559,7 @@ class GlueCatalogTest { .tags(Map.of("Environment", "dev", "Project", "project1")) .build()); - String databaseArn = "arn:aws:glue:us-east-1:000000000000:database/" + DATABASE_TAGGED_NAME; + String databaseArn = TestFixtures.arn("glue", "000000000000", "database/" + DATABASE_TAGGED_NAME); GetResourcesResponse response = tagging.getResources(b -> b.resourceARNList(databaseArn)); assertThat(response.resourceTagMappingList()).singleElement().satisfies(mapping -> { @@ -586,7 +586,7 @@ class GlueCatalogTest { .physicalConnectionRequirements(PhysicalConnectionRequirements.builder() .subnetId("subnet-0123456789abcdef0") .securityGroupIdList("sg-0123456789abcdef0") - .availabilityZone("us-east-1a") + .availabilityZone(TestFixtures.region().id() + "a") .build()) .build()) .tags(Map.of("env", "dev")) @@ -660,7 +660,8 @@ class GlueCatalogTest { @DisplayName("The catalog resource policy follows the create, update and delete conditions Terraform sends") void catalogResourcePolicyLifecycle() { String policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\"," - + "\"Principal\":{\"AWS\":\"arn:aws:iam::111122223333:root\"},\"Action\":\"glue:GetTable\",\"Resource\":\"*\"}]}"; + + "\"Principal\":{\"AWS\":\"" + TestFixtures.globalArn("iam", "111122223333", "root") + "\"}," + + "\"Action\":\"glue:GetTable\",\"Resource\":\"*\"}]}"; String policyV2 = policy.replace("glue:GetTable", "glue:GetTables"); // Start from no policy; the catalog is shared with other tests. try { diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GuardDutyTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GuardDutyTest.java index 7cd424f5d7..41f34acb15 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GuardDutyTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GuardDutyTest.java @@ -99,7 +99,7 @@ class GuardDutyTest { .isEqualTo(FindingPublishingFrequency.ONE_HOUR); String detectorArn = - "arn:aws:guardduty:us-east-1:000000000000:detector/" + detectorId; + TestFixtures.arn("guardduty", "000000000000", "detector/" + detectorId); guardduty.tagResource(request -> request .resourceArn(detectorArn) .tags(Map.of("team", "security"))); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java index 812a4dad6d..c1bff1fcb9 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java @@ -154,7 +154,8 @@ class IotTest { @Test void domainConfigurationLifecycle() { String name = "java-iot-domain"; - String certificateArn = "arn:aws:acm:us-east-1:000000000000:certificate/11111111-1111-1111-1111-111111111111"; + String certificateArn = TestFixtures.arn("acm", "000000000000", + "certificate/11111111-1111-1111-1111-111111111111"); boolean leftOver = iot.listDomainConfigurations(ListDomainConfigurationsRequest.builder().build()) .domainConfigurations().stream() .anyMatch(summary -> name.equals(summary.domainConfigurationName())); @@ -191,7 +192,7 @@ class IotTest { .build()); assertThat(created.domainConfigurationName()).isEqualTo(name); assertThat(created.domainConfigurationArn()) - .startsWith("arn:aws:iot:us-east-1:000000000000:domainconfiguration/" + name + "/"); + .startsWith(TestFixtures.arn("iot", "000000000000", "domainconfiguration/" + name + "/")); assertThatThrownBy(() -> iot.createDomainConfiguration(CreateDomainConfigurationRequest.builder() .domainConfigurationName(name) @@ -376,7 +377,7 @@ class IotTest { assertThat(remainingTags.tags()).extracting(Tag::key).containsExactly("owner"); assertThatThrownBy(() -> iot.listTagsForResource(ListTagsForResourceRequest.builder() - .resourceArn("arn:aws:iot:us-east-1:000000000000:thing/missing-tagged-thing") + .resourceArn(TestFixtures.arn("iot", "000000000000", "thing/missing-tagged-thing")) .build())) .isInstanceOf(ResourceNotFoundException.class); } @@ -506,7 +507,8 @@ class IotTest { .ruleDisabled(false) .actions(Action.builder() .sqs(SqsAction.builder() - .roleArn("arn:aws:iam::000000000000:role/iot-rule-role") + .roleArn(TestFixtures.globalArn( + "iam", "000000000000", "role/iot-rule-role")) .queueUrl(queueUrl) .useBase64(false) .build()) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java index a53429d15c..2882758a04 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java @@ -40,7 +40,7 @@ class MacieOrganizationAdministrationTest { .account(account -> account.accountId(MEMBER_ACCOUNT).email("member@example.com")) .tags(java.util.Map.of("team", "security"))); assertThat(member.arn()) - .isEqualTo("arn:aws:macie2:us-east-1:" + ADMIN_ACCOUNT + ":member/" + MEMBER_ACCOUNT); + .isEqualTo(TestFixtures.arn("macie2", ADMIN_ACCOUNT, "member/" + MEMBER_ACCOUNT)); assertThat(administrator.listMembers(request -> request.onlyAssociated("true")).members()) .anySatisfy(account -> { assertThat(account.accountId()).isEqualTo(MEMBER_ACCOUNT); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/NeptuneTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/NeptuneTest.java index e61128459d..9e5475bbb6 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/NeptuneTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/NeptuneTest.java @@ -83,7 +83,7 @@ class NeptuneTest { assertThat(cluster.dbClusterIdentifier()).isEqualTo(CLUSTER_ID); assertThat(cluster.engine()).isEqualTo("neptune"); assertThat(cluster.status()).isEqualTo("available"); - assertThat(cluster.dbClusterArn()).startsWith("arn:aws:neptune:"); + assertThat(cluster.dbClusterArn()).startsWith("arn:" + TestFixtures.partition() + ":neptune:"); assertThat(cluster.port()).isGreaterThan(0); assertThat(cluster.storageEncrypted()).isFalse(); assertThat(cluster.backupRetentionPeriod()).isEqualTo(1); @@ -158,7 +158,7 @@ class NeptuneTest { @Order(6) @DisplayName("AddRoleToDBCluster and RemoveRoleFromDBCluster maintain AssociatedRoles") void rolesRoundTrip() { - String roleArn = "arn:aws:iam::000000000000:role/" + CLUSTER_ID; + String roleArn = TestFixtures.globalArn("iam", "000000000000", "role/" + CLUSTER_ID); neptune.addRoleToDBCluster(AddRoleToDbClusterRequest.builder() .dbClusterIdentifier(CLUSTER_ID).roleArn(roleArn).build()); @@ -221,7 +221,7 @@ class NeptuneTest { assertThat(instance.dbInstanceIdentifier()).isEqualTo(INSTANCE_ID); assertThat(instance.dbClusterIdentifier()).isEqualTo(CLUSTER_ID); assertThat(instance.dbInstanceStatus()).isEqualTo("available"); - assertThat(instance.dbInstanceArn()).startsWith("arn:aws:neptune:"); + assertThat(instance.dbInstanceArn()).startsWith("arn:" + TestFixtures.partition() + ":neptune:"); assertThat(instance.autoMinorVersionUpgrade()).isTrue(); assertThat(instance.promotionTier()).isZero(); assertThat(instance.publiclyAccessible()).isFalse(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/OrganizationsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/OrganizationsTest.java index f7006ac749..16dea8c308 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/OrganizationsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/OrganizationsTest.java @@ -1,9 +1,6 @@ package com.floci.test; import org.junit.jupiter.api.Test; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; -import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.organizations.OrganizationsClient; import software.amazon.awssdk.services.organizations.model.Account; import software.amazon.awssdk.services.organizations.model.AccessDeniedException; @@ -46,16 +43,6 @@ public class OrganizationsTest { private final OrganizationsClient client = TestFixtures.organizationsClient(); - /** A client whose 12-digit access key id makes Floci treat the caller as that account. */ - private static OrganizationsClient clientFor(String accountId) { - return OrganizationsClient.builder() - .endpointOverride(TestFixtures.endpoint()) - .region(Region.US_EAST_1) - .credentialsProvider(StaticCredentialsProvider.create( - AwsBasicCredentials.create(accountId, "test"))) - .build(); - } - @Test public void testFullLifecycle() { // 1. Create the organization. @@ -68,7 +55,7 @@ public class OrganizationsTest { try { assertThat(organization.id()).matches("o-[a-z0-9]{10}"); assertThat(organization.featureSet()).isEqualTo(OrganizationFeatureSet.ALL); - assertThat(organization.arn()).startsWith("arn:aws:organizations::"); + assertThat(organization.arn()).startsWith("arn:" + TestFixtures.partition() + ":organizations::"); assertThat(managementAccountId).isNotBlank(); assertThat(client.describeOrganization().organization().id()).isEqualTo(organization.id()); @@ -223,7 +210,7 @@ public class OrganizationsTest { client.deleteResourcePolicy(r -> { }); // 10. The invitation handshake, driven from both sides. - try (OrganizationsClient invitedClient = clientFor(INVITED_ACCOUNT)) { + try (OrganizationsClient invitedClient = TestFixtures.organizationsClient(INVITED_ACCOUNT)) { assertThatThrownBy(invitedClient::describeOrganization) .isInstanceOf(AwsOrganizationsNotInUseException.class); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsIamTokenCompatTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsIamTokenCompatTest.java index c5797f17e6..33c7f34a9f 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsIamTokenCompatTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsIamTokenCompatTest.java @@ -44,7 +44,7 @@ class RdsIamTokenCompatTest { private static final StaticCredentialsProvider CREDENTIALS = StaticCredentialsProvider.create(AwsBasicCredentials.create("test", "test")); - private static final Region REGION = Region.US_EAST_1; + private static final Region REGION = TestFixtures.region(); private static final String USERNAME = "admin"; private static final String PASSWORD = "secret-pass-123"; private static final String DATABASE = "appdb"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java index 65616db9b3..9108634e55 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsJdbcCompatTest.java @@ -38,7 +38,7 @@ class RdsJdbcCompatTest { private static final StaticCredentialsProvider CREDENTIALS = StaticCredentialsProvider.create(AwsBasicCredentials.create("test", "test")); - private static final Region REGION = Region.US_EAST_1; + private static final Region REGION = TestFixtures.region(); private static final String USERNAME = "admin"; private static final String PASSWORD = "secret123"; private static final String DATABASE = "app"; diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java index 6c28a561dd..384098da22 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ResourceExplorer2Test.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; class ResourceExplorer2Test { private static ResourceExplorer2Client client; - // The emulator auto-provisions an index only in the default region (us-east-1). CreateIndex + // The emulator auto-provisions an index only in the default region (the fixture region). CreateIndex // there is a no-op/conflict, so index create+delete is exercised against a second region // that starts with no index, matching AWS's one-index-per-region rule. private static ResourceExplorer2Client altRegionClient; @@ -273,7 +273,8 @@ class ResourceExplorer2Test { @Order(22) void batchGetViewReturnsViewsAndErrorsForMissing() { assumeFalse(TestFixtures.isRealAws(), "Depends on created view"); - String bogusArn = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/does-not-exist/00000000-0000-0000-0000-000000000000"; + String bogusArn = TestFixtures.arn("resource-explorer-2", "000000000000", + "view/does-not-exist/00000000-0000-0000-0000-000000000000"); BatchGetViewResponse response = client.batchGetView(BatchGetViewRequest.builder() .viewArns(createdViewArn, bogusArn) @@ -408,7 +409,8 @@ class ResourceExplorer2Test { // Real AWS: 401 UnauthorizedException (auth checked before existence for wrong-account ARN) // Floci: 404 ResourceNotFoundException assertThatThrownBy(() -> client.getView(GetViewRequest.builder() - .viewArn("arn:aws:resource-explorer-2:us-east-1:000000000000:view/nope/00000000-0000-0000-0000-000000000000") + .viewArn(TestFixtures.arn("resource-explorer-2", "000000000000", + "view/nope/00000000-0000-0000-0000-000000000000")) .build())) .isInstanceOf(ResourceExplorer2Exception.class); } @@ -419,7 +421,7 @@ class ResourceExplorer2Test { // Real AWS: 403 AccessDeniedException (auth checked before existence for wrong-account ARN) // Floci: 404 ResourceNotFoundException assertThatThrownBy(() -> client.deleteIndex(DeleteIndexRequest.builder() - .arn("arn:aws:resource-explorer-2:us-east-1:000000000000:index/nonexistent") + .arn(TestFixtures.arn("resource-explorer-2", "000000000000", "index/nonexistent")) .build())) .isInstanceOf(ResourceExplorer2Exception.class); } @@ -456,7 +458,7 @@ class ResourceExplorer2Test { .as("IncludedProperty.Name").isEqualTo("tags"); // Drill into scope - assertThat(view.scope()).as("View.Scope").contains("arn:aws:iam:"); + assertThat(view.scope()).as("View.Scope").contains("arn:" + TestFixtures.partition() + ":iam:"); // Cleanup client.deleteView(DeleteViewRequest.builder().viewArn(arn).build()); @@ -528,7 +530,8 @@ class ResourceExplorer2Test { @Order(55) void batchGetViewErrorFieldsDeserialize() { assumeFalse(TestFixtures.isRealAws(), "Uses floci-specific bogus ARN format"); - String bogus = "arn:aws:resource-explorer-2:us-east-1:000000000000:view/x/00000000-0000-0000-0000-000000000000"; + String bogus = TestFixtures.arn("resource-explorer-2", "000000000000", + "view/x/00000000-0000-0000-0000-000000000000"); BatchGetViewResponse response = client.batchGetView(BatchGetViewRequest.builder() .viewArns(bogus) @@ -576,7 +579,7 @@ class ResourceExplorer2Test { UpdateViewResponse updated = client.updateView(UpdateViewRequest.builder() .viewArn(arn) - .filters(SearchFilter.builder().filterString("region:us-east-1").build()) + .filters(SearchFilter.builder().filterString("region:" + TestFixtures.region().id()).build()) .includedProperties(IncludedProperty.builder().name("tags").build()) .build()); @@ -584,7 +587,7 @@ class ResourceExplorer2Test { assertThat(view.viewArn()).isEqualTo(arn); assertThat(view.filters()).as("Updated Filters").isNotNull(); assertThat(view.filters().filterString()) - .as("Updated FilterString").isEqualTo("region:us-east-1"); + .as("Updated FilterString").isEqualTo("region:" + TestFixtures.region().id()); assertThat(view.includedProperties()).hasSize(1); assertThat(view.includedProperties().get(0).name()).isEqualTo("tags"); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Route53Test.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Route53Test.java index d793d6568b..4bf1e52bd0 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Route53Test.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Route53Test.java @@ -30,6 +30,8 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; @DisplayName("Route 53") class Route53Test { + private static final VPCRegion VPC_REGION = VPCRegion.fromValue(TestFixtures.region().id()); + private static Route53Client route53; @BeforeAll @@ -84,11 +86,11 @@ class Route53Test { try { VPC zoneVpc = VPC.builder() .vpcId(zoneVpcId) - .vpcRegion(VPCRegion.US_EAST_1) + .vpcRegion(VPC_REGION) .build(); VPC spokeVpc = VPC.builder() .vpcId(spokeVpcId) - .vpcRegion(VPCRegion.US_EAST_1) + .vpcRegion(VPC_REGION) .build(); zoneId = zoneRoute53.createHostedZone(CreateHostedZoneRequest.builder() @@ -123,7 +125,7 @@ class Route53Test { .singleElement() .satisfies(vpc -> { assertThat(vpc.vpcId()).isEqualTo(spokeVpcId); - assertThat(vpc.vpcRegion()).isEqualTo(VPCRegion.US_EAST_1); + assertThat(vpc.vpcRegion()).isEqualTo(VPC_REGION); }); vpcRoute53.associateVPCWithHostedZone( @@ -135,7 +137,7 @@ class Route53Test { assertThat(vpcRoute53.listHostedZonesByVPC( ListHostedZonesByVpcRequest.builder() .vpcId(spokeVpcId) - .vpcRegion(VPCRegion.US_EAST_1) + .vpcRegion(VPC_REGION) .build()).hostedZoneSummaries()) .singleElement() .satisfies(summary -> { @@ -157,7 +159,7 @@ class Route53Test { assertThat(vpcRoute53.listHostedZonesByVPC( ListHostedZonesByVpcRequest.builder() .vpcId(spokeVpcId) - .vpcRegion(VPCRegion.US_EAST_1) + .vpcRegion(VPC_REGION) .build()).hostedZoneSummaries()) .singleElement(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3TablesTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3TablesTest.java index 1bc2814d27..eeb13feee0 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3TablesTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3TablesTest.java @@ -65,7 +65,8 @@ class S3TablesTest { .storageClassConfiguration(StorageClassConfiguration.builder().storageClass(StorageClass.STANDARD).build()) .build()); bucketArn = created.arn(); - assertThat(bucketArn).contains("arn:aws:s3tables:").endsWith("bucket/" + bucketName); + assertThat(bucketArn).contains("arn:" + TestFixtures.partition() + ":s3tables:") + .endsWith("bucket/" + bucketName); GetTableBucketResponse fetched = client.getTableBucket( GetTableBucketRequest.builder().tableBucketARN(bucketArn).build()); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3VectorsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3VectorsTest.java index 4ba9b77300..fcb0f23186 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3VectorsTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3VectorsTest.java @@ -51,7 +51,7 @@ class S3VectorsTest { .vectorBucketName(bucketName) .build() ); - assertThat(response.vectorBucketArn()).isNotBlank().contains("arn:aws:s3vectors:"); + assertThat(response.vectorBucketArn()).isNotBlank().contains("arn:" + TestFixtures.partition() + ":s3vectors:"); } @Test @@ -88,7 +88,7 @@ class S3VectorsTest { .dataType("float32") .build() ); - assertThat(response.indexArn()).isNotBlank().contains("arn:aws:s3vectors:"); + assertThat(response.indexArn()).isNotBlank().contains("arn:" + TestFixtures.partition() + ":s3vectors:"); } @Test diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java index 95f194edd3..d0407dbd12 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java @@ -251,14 +251,14 @@ class SecretsManagerTest { lambda.createFunction(CreateFunctionRequest.builder() .functionName(lambdaName) .runtime(Runtime.fromValue("nodejs20.x")) - .role("arn:aws:iam::000000000000:role/dummy-role") + .role(TestFixtures.globalArn("iam", "000000000000", "role/dummy-role")) .handler("index.handler") .code(FunctionCode.builder().zipFile(SdkBytes.fromByteArray(baos.toByteArray())).build()) .build()); RotateSecretResponse rotateResponse = sm.rotateSecret(RotateSecretRequest.builder() .secretId(secretName) - .rotationLambdaARN("arn:aws:lambda:us-east-1:000000000000:function:" + lambdaName) + .rotationLambdaARN(TestFixtures.arn("lambda", "000000000000", "function:" + lambdaName)) .rotationRules(RotationRulesType.builder().automaticallyAfterDays(30L).build()) .build()); @@ -320,7 +320,7 @@ class SecretsManagerTest { assertThatThrownBy(() -> sm.createSecret(CreateSecretRequest.builder() .name(kmsSecretName) .secretString("kms-value") - .kmsKeyId("arn:aws:kms:us-east-1:000000000000:key/does-not-exist") + .kmsKeyId(TestFixtures.arn("kms", "000000000000", "key/does-not-exist")) .build())) .isInstanceOf(InvalidParameterException.class) .hasMessageContaining("You can't access the KMS key"); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java index 48a25406f1..88f90fe488 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesEventPublishingTest.java @@ -197,8 +197,8 @@ class SesEventPublishingTest { firehoseStreamArn = firehose.createDeliveryStream(CreateDeliveryStreamRequest.builder() .deliveryStreamName(firehoseStreamName) .s3DestinationConfiguration(S3DestinationConfiguration.builder() - .bucketARN("arn:aws:s3:::" + firehoseBucket) - .roleARN("arn:aws:iam::000000000000:role/sdk-evt-fh-role") + .bucketARN(TestFixtures.globalArn("s3", "", firehoseBucket)) + .roleARN(TestFixtures.globalArn("iam", "000000000000", "role/sdk-evt-fh-role")) .prefix(firehoseStreamName + "/") // Floci does not enforce AWS's 60s minimum interval, which keeps // the delivery wait short (would need 60+ against real AWS). @@ -219,7 +219,7 @@ class SesEventPublishingTest { .enabled(true) .matchingEventTypes(EventType.SEND) .kinesisFirehoseDestination(KinesisFirehoseDestination.builder() - .iamRoleArn("arn:aws:iam::000000000000:role/sdk-evt-fh-role") + .iamRoleArn(TestFixtures.globalArn("iam", "000000000000", "role/sdk-evt-fh-role")) .deliveryStreamArn(firehoseStreamArn) .build()) .build()) @@ -244,7 +244,7 @@ class SesEventPublishingTest { .rule(ebRuleName) .targets(Target.builder().id("1").arn(ebQueueArn).build()) .build()); - ebBusArn = "arn:aws:events:us-east-1:000000000000:event-bus/default"; + ebBusArn = TestFixtures.arn("events", "000000000000", "event-bus/default"); ses.createConfigurationSet(CreateConfigurationSetRequest.builder() .configurationSetName(csNameEB) .build()); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java index 7c67b1ef70..75ac98f6d0 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java @@ -108,7 +108,7 @@ class SsoOidcTest { String instanceArn = sso.listInstances(request -> {}).instances().get(0).instanceArn(); String applicationArn = sso.createApplication(request -> request .instanceArn(instanceArn) - .applicationProviderArn("arn:aws:sso::aws:applicationProvider/custom") + .applicationProviderArn(TestFixtures.globalArn("sso", "aws", "applicationProvider/custom")) .name("Floci IAM OIDC SDK")) .applicationArn();