mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 06:47:41 -05:00
test(compat): build partition-aware ARNs in the partition nightly's failing tests (#6451)
The partition nightly has failed every night since 2026-10-20. Every failure is on the test side: - ApiGatewayV2WebSocketDataPlaneTest hard-coded arn:aws:lambda:us-east-1 integration and authorizer URIs. Since #6001 Floci invokes the function in the region the ARN names, so $connect answered 500 in any other region. - RedshiftOperationsTest tagged a us-east-1 literal ARN, which #6026 rejects. - EmrServerlessJobRunTest expected createdBy to start with arn:aws:. - Ec2TagRegionTest failed in a partition with one region; it now skips there. ResourceGroupsTest#capacityPoolLifecycle is allowlisted for eusc-de-east-1: the Resource Groups model's GroupStringV2 and ResourceArn patterns cannot match any eusc-de-east-1 ARN, and Floci enforces the model as published. Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
a16478cd91
commit
afb4afd2f1
5 files changed
+21
-13
No files matched your search
+5
-5
@@ -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();
|
||||
|
||||
|
||||
+7
-4
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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");
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user