test(partition): exercise seven China-only packages in every non-commercial partition (#5488)

* test(partition): exercise seven China-only packages in every non-commercial partition

smoke-exemptions.tsv exempted eight packages as covered by another test,
and for all eight that test ran through the emulator in aws-cn only. Seven
now run in every non-commercial partition:

- cloudformation, kms, ssm and servicecatalog: the four probes of
  PartitionArnMintingIntegrationTest run once per case of PartitionMatrix.
- lambda and stepfunctions: a function and a state machine case in the
  smoke test, so both rows leave the exemptions.
- s3: S3PartitionIntegrationTest checks the own-constraint rule on every
  non-commercial regional endpoint instead of cn-north-1 alone.

cloudtrail stays covered in one partition: a trail delivers into its
bucket, which a cross-partition case would have to drain before cleanup.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* test(partition): share the non-commercial case source and register two cleanups before the create

nonCommercialCases() existed in three test classes. It moves to
PartitionMatrix, with a constant for its @MethodSource name, and
PartitionArnMintingIntegrationTest uses PartitionMatrix.ACCOUNT instead of
its own copy.

The Lambda and Step Functions smoke cases registered their delete after
reading the create response, so a failure in between left the resource in
the shared emulator. Both now register it first, by name.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* test(partition): drop a stray blank line between import groups

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-12 06:46:21 -04:00
1 parent 32cb4b7b8b
commit 4e2ccfb44f
5 files changed
+192 -134

No files matched your search

@@ -2,12 +2,15 @@ package io.github.hectorvent.floci.core.common;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.github.hectorvent.floci.testing.PartitionMatrix;
import io.github.hectorvent.floci.testing.PartitionMatrix.PartitionCase;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
@@ -15,15 +18,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Every ARN minted for a request signed in another partition carries that partition. One probe
* per sweep group: the CloudFormation pseudo-parameters (template engine), a KMS default key
* policy principal (an IAM root ARN built through the resolver), an SSM parameter (a regional
* {@code Arn.of} site) and a Service Catalog portfolio (a service that never imported the helper).
* Every ARN minted for a request signed in another partition carries that partition, in every
* non-commercial partition. One probe per sweep group: the CloudFormation pseudo-parameters
* (template engine), a KMS default key policy principal (an IAM root ARN built through the
* resolver), an SSM parameter (a regional {@code Arn.of} site) and a Service Catalog portfolio (a
* service that never imported the helper).
*/
@QuarkusTest
class PartitionArnMintingIntegrationTest {
private static final String REGION = "cn-north-1";
private static final String JSON_1_1 = "application/x-amz-json-1.1";
@RegisterExtension
@@ -34,8 +37,11 @@ class PartitionArnMintingIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
@Test
void cloudFormationPseudoParametersFollowTheStackRegion() {
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudFormationPseudoParametersFollowTheStackRegion(PartitionCase partitionCase) {
String region = partitionCase.region();
String partition = partitionCase.partition();
String stackName = "partition-pseudo-" + Long.toString(System.nanoTime(), 36);
String template = """
{
@@ -48,34 +54,38 @@ class PartitionArnMintingIntegrationTest {
}
""";
given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "cloudformation"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "cloudformation"))
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "CreateStack")
.formParam("StackName", stackName)
.formParam("TemplateBody", template)
.when().post("/").then().statusCode(200);
cleanup.register(() -> given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "cloudformation"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "cloudformation"))
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DeleteStack")
.formParam("StackName", stackName)
.when().post("/"));
given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "cloudformation"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "cloudformation"))
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeStacks")
.formParam("StackName", stackName)
.when().post("/").then().statusCode(200)
.body(containsString("<OutputValue>aws-cn</OutputValue>"))
.body(containsString("<OutputValue>amazonaws.com.cn</OutputValue>"))
.body(containsString("<OutputValue>arn:aws-cn:iam::aws:policy/AdministratorAccess</OutputValue>"));
.body(containsString("<OutputValue>" + partition + "</OutputValue>"))
.body(containsString("<OutputValue>" + partitionCase.dnsSuffix() + "</OutputValue>"))
.body(containsString("<OutputValue>arn:" + partition
+ ":iam::aws:policy/AdministratorAccess</OutputValue>"));
}
@Test
void kmsDefaultKeyPolicyNamesTheRootPrincipalInTheRequestPartition() {
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void kmsDefaultKeyPolicyNamesTheRootPrincipalInTheRequestPartition(PartitionCase partitionCase) {
String region = partitionCase.region();
String partition = partitionCase.partition();
Response created = given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "kms"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "kms"))
.header("X-Amz-Target", "TrentService.CreateKey")
.contentType(JSON_1_1)
.body("{}")
@@ -84,47 +94,50 @@ class PartitionArnMintingIntegrationTest {
String keyId = created.jsonPath().getString("KeyMetadata.KeyId");
String keyArn = created.jsonPath().getString("KeyMetadata.Arn");
cleanup.register(() -> given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "kms"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "kms"))
.header("X-Amz-Target", "TrentService.ScheduleKeyDeletion")
.contentType(JSON_1_1)
.body("{\"KeyId\":\"" + keyId + "\",\"PendingWindowInDays\":7}")
.when().post("/"));
assertTrue(keyArn.startsWith("arn:aws-cn:kms:" + REGION + ":"), keyArn);
assertTrue(keyArn.startsWith("arn:" + partition + ":kms:" + region + ":"), keyArn);
String policy = given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "kms"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "kms"))
.header("X-Amz-Target", "TrentService.GetKeyPolicy")
.contentType(JSON_1_1)
.body("{\"KeyId\":\"" + keyId + "\",\"PolicyName\":\"default\"}")
.when().post("/").then().statusCode(200)
.extract().jsonPath().getString("Policy");
assertTrue(policy.contains("arn:aws-cn:iam::000000000000:root"), policy);
assertTrue(policy.contains("arn:" + partition + ":iam::" + PartitionMatrix.ACCOUNT + ":root"), policy);
}
@Test
void ssmParameterArnIsMintedInTheRequestPartition() {
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void ssmParameterArnIsMintedInTheRequestPartition(PartitionCase partitionCase) {
String region = partitionCase.region();
String name = "/partition/" + Long.toString(System.nanoTime(), 36);
given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "ssm"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "ssm"))
.header("X-Amz-Target", "AmazonSSM.PutParameter")
.contentType(JSON_1_1)
.body("{\"Name\":\"" + name + "\",\"Type\":\"String\",\"Value\":\"v\"}")
.when().post("/").then().statusCode(200);
cleanup.register(() -> given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "ssm"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "ssm"))
.header("X-Amz-Target", "AmazonSSM.DeleteParameter")
.contentType(JSON_1_1)
.body("{\"Name\":\"" + name + "\"}")
.when().post("/"));
String arn = given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "ssm"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "ssm"))
.header("X-Amz-Target", "AmazonSSM.GetParameter")
.contentType(JSON_1_1)
.body("{\"Name\":\"" + name + "\"}")
.when().post("/").then().statusCode(200)
.extract().jsonPath().getString("Parameter.ARN");
assertEquals("arn:aws-cn:ssm:" + REGION + ":000000000000:parameter" + name, arn);
assertEquals("arn:" + partitionCase.partition() + ":ssm:" + region + ":" + PartitionMatrix.ACCOUNT
+ ":parameter" + name, arn);
}
/**
@@ -158,11 +171,13 @@ class PartitionArnMintingIntegrationTest {
assertEquals("arn:aws-cn:ssm:cn-northwest-1:000000000000:parameter" + name, arn);
}
@Test
void serviceCatalogPortfolioArnIsMintedInTheRequestPartition() {
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void serviceCatalogPortfolioArnIsMintedInTheRequestPartition(PartitionCase partitionCase) {
String region = partitionCase.region();
String token = Long.toString(System.nanoTime(), 36);
Response created = given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "servicecatalog"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "servicecatalog"))
.header("X-Amz-Target", "AWS242ServiceCatalogService.CreatePortfolio")
.contentType(JSON_1_1)
.body("{\"DisplayName\":\"partition-" + token + "\",\"ProviderName\":\"floci\",\"IdempotencyToken\":\"" + token + "\"}")
@@ -170,13 +185,14 @@ class PartitionArnMintingIntegrationTest {
created.then().statusCode(200);
String id = created.jsonPath().getString("PortfolioDetail.Id");
cleanup.register(() -> given()
.header("Authorization", PartitionMatrix.sigV4Auth(REGION, "servicecatalog"))
.header("Authorization", PartitionMatrix.sigV4Auth(region, "servicecatalog"))
.header("X-Amz-Target", "AWS242ServiceCatalogService.DeletePortfolio")
.contentType(JSON_1_1)
.body("{\"Id\":\"" + id + "\"}")
.when().post("/"));
String arn = created.jsonPath().getString("PortfolioDetail.ARN");
assertEquals("arn:aws-cn:catalog:" + REGION + ":000000000000:portfolio/" + id, arn);
assertEquals("arn:" + partitionCase.partition() + ":catalog:" + region + ":" + PartitionMatrix.ACCOUNT
+ ":portfolio/" + id, arn);
}
}
@@ -17,7 +17,6 @@ import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Set;
import java.util.stream.Stream;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -44,11 +43,11 @@ class PartitionCrossServiceSmokeIntegrationTest {
"cloudfront", "cloudmap", "cloudwatch", "codebuild", "codedeploy", "codepipeline", "cognito",
"configservice", "connect", "controlcatalog", "controltower", "datasync", "dlm", "dms", "dynamodb", "ec2",
"ecr", "ecs", "efs", "eks", "elasticache", "elasticbeanstalk", "elbv2", "emr", "emrserverless",
"eventbridge", "firehose", "fis", "glue", "guardduty", "iot", "kinesis", "kinesisanalytics",
"eventbridge", "firehose", "fis", "glue", "guardduty", "iot", "kinesis", "kinesisanalytics", "lambda",
"lambdamicrovms", "memorydb", "msk", "mwaa", "networkfirewall", "oam", "opensearch", "organizations",
"pipes", "ram", "rds", "redshift", "redshiftserverless", "resourceexplorer2", "route53resolver",
"s3tables", "s3vectors", "sagemaker", "scheduler", "secretsmanager", "servicequotas", "ses", "sns", "sqs",
"timestreaminfluxdb", "transfer", "verifiedpermissions", "wafv2");
"stepfunctions", "timestreaminfluxdb", "transfer", "verifiedpermissions", "wafv2");
private static final String JSON_1_0 = "application/x-amz-json-1.0";
private static final String JSON_1_1 = "application/x-amz-json-1.1";
@@ -62,12 +61,8 @@ class PartitionCrossServiceSmokeIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
static Stream<PartitionCase> nonCommercialCases() {
return PartitionMatrix.cases().filter(c -> !"aws".equals(c.partition()));
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void snsTopicArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "sns");
String name = unique("smoke-topic", partitionCase);
@@ -86,7 +81,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void kinesisStreamArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "kinesis");
String name = unique("smoke-stream", partitionCase);
@@ -103,7 +98,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void firehoseDeliveryStreamArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "firehose");
String name = unique("smoke-firehose", partitionCase);
@@ -117,7 +112,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void httpApiEndpointHost(PartitionCase partitionCase) {
String region = offered(partitionCase, "apigateway");
String name = unique("smoke-http-api", partitionCase);
@@ -133,7 +128,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void elbv2TargetGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "elasticloadbalancing");
String name = unique("smoke-tg", partitionCase);
@@ -157,7 +152,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void glueSchemaRegistryArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "glue");
String name = unique("smoke-registry", partitionCase);
@@ -170,7 +165,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void iotThingArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "iot");
String name = unique("smoke-thing", partitionCase);
@@ -184,7 +179,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void acmCertificateArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "acm");
String domain = unique("smoke-cert", partitionCase) + ".example.com";
@@ -198,7 +193,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void codeBuildProjectArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "codebuild");
String name = unique("smoke-project", partitionCase);
@@ -221,7 +216,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void batchComputeEnvironmentArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "batch");
String name = unique("smoke-ce", partitionCase);
@@ -245,7 +240,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void efsFileSystemArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "elasticfilesystem");
Response created = signed(region, "elasticfilesystem")
@@ -259,7 +254,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void sqsQueueArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "sqs");
String name = unique("smoke-queue", partitionCase);
@@ -276,7 +271,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void secretsManagerSecretArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "secretsmanager");
String name = unique("smoke-secret", partitionCase);
@@ -290,7 +285,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void dynamoDbTableArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "dynamodb");
String name = unique("smoke-table", partitionCase);
@@ -311,7 +306,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudWatchAlarmArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "monitoring");
String name = unique("smoke-alarm", partitionCase);
@@ -343,7 +338,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudWatchDashboardArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "monitoring");
String name = unique("smoke-dashboard", partitionCase);
@@ -368,7 +363,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudWatchLogGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "logs");
String name = unique("smoke-log-group", partitionCase);
@@ -384,7 +379,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void eventBridgeEventBusArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "events");
String name = unique("smoke-bus", partitionCase);
@@ -397,7 +392,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void ecsClusterArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ecs");
String name = unique("smoke-cluster", partitionCase);
@@ -411,7 +406,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void rdsParameterGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "rds");
String name = unique("smoke-pg", partitionCase);
@@ -433,7 +428,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void ec2IpamArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ec2");
Response created = signed(region, "ec2")
@@ -451,7 +446,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void apiGatewayDomainNameArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "apigateway");
String domain = unique("smoke-domain", partitionCase) + ".example.com";
@@ -472,7 +467,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void sesTenantArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ses");
String name = unique("smoke-tenant", partitionCase);
@@ -489,7 +484,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void eksClusterArnAndOidcIssuerHost(PartitionCase partitionCase) {
String region = offered(partitionCase, "eks");
String name = unique("smoke-eks", partitionCase);
@@ -506,7 +501,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cognitoUserPoolArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "cognito-idp");
String name = unique("smoke-pool", partitionCase);
@@ -520,7 +515,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void appSyncGraphqlApiArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "appsync");
Response created = signed(region, "appsync")
@@ -533,7 +528,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void openSearchDomainArnAndEndpointHost(PartitionCase partitionCase) {
String region = offered(partitionCase, "es");
String name = "smoke" + Long.toString(System.nanoTime(), 36);
@@ -549,7 +544,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void amazonMqBrokerArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "mq");
String body = """
@@ -568,7 +563,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void mskClusterArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "kafka");
String arn = signed(region, "kafka")
@@ -581,7 +576,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void elastiCacheParameterGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "elasticache");
String name = unique("smoke-cpg", partitionCase);
@@ -603,7 +598,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void memoryDbAclArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "memorydb");
String name = unique("smoke-acl", partitionCase);
@@ -617,7 +612,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void route53ResolverFirewallDomainListArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "route53resolver");
String name = unique("smoke-domains", partitionCase);
@@ -631,7 +626,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void bedrockAgentCoreGatewayArnAndUrlHost(PartitionCase partitionCase) {
String region = offered(partitionCase, "bedrock-agentcore");
String body = """
@@ -649,7 +644,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudFrontFunctionArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "cloudfront");
String name = unique("smoke-function", partitionCase);
@@ -675,7 +670,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void ramResourceShareArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ram");
String arn = signed(region, "ram")
@@ -690,7 +685,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void oamSinkArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "oam");
String arn = signed(region, "oam")
@@ -706,7 +701,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void schedulerScheduleGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "scheduler");
String name = unique("smoke-group", partitionCase);
@@ -720,7 +715,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void backupVaultArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "backup");
String name = unique("smoke-vault", partitionCase);
@@ -734,7 +729,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void wafv2RegionalIpSetArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "wafv2");
String name = unique("smoke-ipset", partitionCase);
@@ -750,7 +745,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void s3TablesTableBucketArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "s3tables");
String name = "smoke-" + Long.toString(System.nanoTime(), 36);
@@ -764,7 +759,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void guardDutyDetectorServiceRoleArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "guardduty");
String detectorId = signed(region, "guardduty")
@@ -779,7 +774,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void costExplorerAnomalyMonitorArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ce");
String body = """
@@ -795,7 +790,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void autoScalingLaunchConfigurationArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "autoscaling");
String name = unique("smoke-lc", partitionCase);
@@ -822,7 +817,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void applicationAutoScalingScalableTargetArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "application-autoscaling");
String resourceId = "table/" + unique("smoke-table", partitionCase);
@@ -840,7 +835,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void codeDeployOnPremisesInstanceArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "codedeploy");
String name = unique("smoke-instance", partitionCase);
@@ -858,7 +853,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void configRuleArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "config");
String name = unique("smoke-rule", partitionCase);
@@ -878,7 +873,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void controlTowerBaselineArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "controltower");
String arn = signed(region, "controltower")
@@ -890,7 +885,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void lambdaMicrovmsManagedImageArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "lambda");
String arn = signed(region, "lambda").when().get("/2025-09-09/managed-microvm-images")
@@ -899,7 +894,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void dlmLifecyclePolicyArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "dlm");
String body = """
@@ -922,7 +917,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void networkFirewallRuleGroupArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "network-firewall");
String name = unique("smoke-rules", partitionCase);
@@ -937,7 +932,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void cloudMapNamespaceArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "servicediscovery");
String target = "Route53AutoNaming_v20170314.";
@@ -960,7 +955,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void accessAnalyzerArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "access-analyzer");
String name = unique("smoke-analyzer", partitionCase);
@@ -974,7 +969,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void prometheusWorkspaceArnAndEndpointHost(PartitionCase partitionCase) {
String region = offered(partitionCase, "aps");
Response created = signed(region, "aps")
@@ -990,7 +985,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void bedrockGuardrailArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "bedrock");
String body = """
@@ -1008,7 +1003,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void connectInstanceArnAndServiceRole(PartitionCase partitionCase) {
String region = offered(partitionCase, "connect");
String body = """
@@ -1028,7 +1023,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void controlCatalogControlArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "controlcatalog");
String arn = signed(region, "controlcatalog")
@@ -1040,7 +1035,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void dataSyncAgentArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "datasync");
String arn = json11(region, "datasync", "FmrsService.CreateAgent",
@@ -1054,7 +1049,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void emrClusterArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "elasticmapreduce");
String body = """
@@ -1071,7 +1066,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void emrServerlessApplicationArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "emr-serverless");
String body = """
@@ -1087,7 +1082,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void bcmDataExportsExportArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "bcm-data-exports");
String target = "AWSBillingAndCostManagementDataExports.";
@@ -1106,7 +1101,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void fisExperimentTemplateArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "fis");
Response created = signed(region, "fis")
@@ -1122,7 +1117,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void pipesPipeArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "pipes");
String name = unique("smoke-pipe", partitionCase);
@@ -1139,7 +1134,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void s3VectorsVectorBucketArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "s3vectors");
String body = "{\"vectorBucketName\":\"" + unique("smoke-vectors", partitionCase) + "\"}";
@@ -1154,7 +1149,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void serviceQuotasQuotaArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "servicequotas");
String arn = json11(region, "servicequotas", "ServiceQuotasV20190624.ListServiceQuotas",
@@ -1165,7 +1160,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void transferServerArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "transfer");
String serverId = json11(region, "transfer", "TransferService.CreateServer", "{}")
@@ -1180,7 +1175,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void verifiedPermissionsPolicyStoreArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "verifiedpermissions");
Response created = json10(region, "verifiedpermissions", "VerifiedPermissions.CreatePolicyStore",
@@ -1193,7 +1188,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void codePipelineWebhookArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "codepipeline");
String name = unique("smoke-webhook", partitionCase);
@@ -1207,7 +1202,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void dmsEndpointArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "dms");
String arn = json11(region, "dms", "AmazonDMSv20160101.CreateEndpoint",
@@ -1221,7 +1216,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void ecrRepositoryArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "ecr");
String name = unique("smoke-repo", partitionCase);
@@ -1235,7 +1230,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void elasticBeanstalkApplicationArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "elasticbeanstalk");
String name = unique("smoke-app", partitionCase);
@@ -1255,7 +1250,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void kinesisAnalyticsApplicationArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "kinesisanalytics");
String name = unique("smoke-flink", partitionCase);
@@ -1275,7 +1270,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void redshiftServerlessNamespaceArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "redshift-serverless");
String body = "{\"namespaceName\":\"" + unique("smoke-namespace", partitionCase) + "\"}";
@@ -1288,7 +1283,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void resourceExplorerViewArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "resource-explorer-2");
String arn = signed(region, "resource-explorer-2")
@@ -1302,7 +1297,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void sageMakerModelArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "sagemaker");
String name = unique("smoke-model", partitionCase);
@@ -1316,7 +1311,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void timestreamInfluxDbInstanceArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "timestream-influxdb");
String target = "AmazonTimestreamInfluxDB.";
@@ -1336,7 +1331,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void mwaaEnvironmentArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "airflow");
String name = unique("smoke-airflow", partitionCase);
@@ -1354,7 +1349,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void organizationArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "organizations");
// An account holds one organization, so this case uses an account no other test class signs with.
@@ -1376,7 +1371,7 @@ class PartitionCrossServiceSmokeIntegrationTest {
}
@ParameterizedTest
@MethodSource("nonCommercialCases")
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void redshiftSnapshotCopyGrantKeyArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "redshift");
String name = unique("smoke-grant", partitionCase);
@@ -1397,6 +1392,41 @@ class PartitionCrossServiceSmokeIntegrationTest {
PartitionMatrix.assertArnIn(partitionCase, arn);
}
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void lambdaFunctionArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "lambda");
String name = unique("smoke-fn", partitionCase);
// By name, before the create: a failure reading the response then leaves nothing behind.
cleanup.register(() -> signed(region, "lambda").when().delete("/2015-03-31/functions/" + name));
String arn = signed(region, "lambda")
.contentType(JSON)
.body("{\"FunctionName\":\"" + name + "\",\"Runtime\":\"nodejs20.x\",\"Handler\":\"index.handler\","
+ "\"Role\":\"arn:" + partitionCase.partition() + ":iam::000000000000:role/lambda-role\"}")
.when().post("/2015-03-31/functions").then().statusCode(201)
.extract().jsonPath().getString("FunctionArn");
PartitionMatrix.assertArnIn(partitionCase, arn);
}
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void stepFunctionsStateMachineArn(PartitionCase partitionCase) {
String region = offered(partitionCase, "states");
String name = unique("smoke-sm", partitionCase);
String definition = "{\\\"StartAt\\\":\\\"Done\\\","
+ "\\\"States\\\":{\\\"Done\\\":{\\\"Type\\\":\\\"Pass\\\",\\\"End\\\":true}}}";
// By the ARN the name gives, before the create: a failure reading the response leaves nothing behind.
cleanup.register(() -> json10(region, "states", "AWSStepFunctions.DeleteStateMachine",
"{\"stateMachineArn\":\"arn:" + partitionCase.partition() + ":states:" + region + ":"
+ PartitionMatrix.ACCOUNT + ":stateMachine:" + name + "\"}").when().post("/"));
String arn = json10(region, "states", "AWSStepFunctions.CreateStateMachine",
"{\"name\":\"" + name + "\",\"definition\":\"" + definition + "\","
+ "\"roleArn\":\"arn:" + partitionCase.partition() + ":iam::000000000000:role/sfn-role\"}")
.when().post("/").then().statusCode(200)
.extract().jsonPath().getString("stateMachineArn");
PartitionMatrix.assertArnIn(partitionCase, arn);
}
/**
* The case's region, or the test is skipped where the partition does not publish the service.
* A service no partition lists (the newer ones {@code endpoints.json} omits) runs everywhere,
@@ -2,10 +2,13 @@ package io.github.hectorvent.floci.services.s3;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.github.hectorvent.floci.testing.PartitionMatrix;
import io.github.hectorvent.floci.testing.PartitionMatrix.PartitionCase;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
@@ -13,8 +16,8 @@ import static org.hamcrest.Matchers.containsString;
/**
* S3's CreateBucket region rules are the same in every partition (moto's {@code aws_verified}
* matrix): the {@code us-east-1} endpoint takes any constraint but its own, and every other
* regional endpoint requires a constraint naming exactly its region. In a China deployment the
* constraint is therefore mandatory, which is what the China SDKs send.
* regional endpoint requires a constraint naming exactly its region. In a non-commercial
* deployment the constraint is therefore mandatory, which is what those SDKs send.
*/
@QuarkusTest
class S3PartitionIntegrationTest {
@@ -42,21 +45,23 @@ class S3PartitionIntegrationTest {
cleanup.register(() -> s3(region).delete("/" + bucket));
}
@Test
void aChinaEndpointRequiresItsOwnLocationConstraint() {
String bucket = bucketName("cn");
s3("cn-north-1").put("/" + bucket).then().statusCode(400)
@ParameterizedTest
@MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)
void aNonCommercialEndpointRequiresItsOwnLocationConstraint(PartitionCase partitionCase) {
String region = partitionCase.region();
String bucket = bucketName(partitionCase.partition());
s3(region).put("/" + bucket).then().statusCode(400)
.body(containsString("<Code>IllegalLocationConstraintException</Code>"))
.body(containsString("<Message>" + UNSPECIFIED + "</Message>"));
s3("cn-north-1").contentType("application/xml").body(constraint("cn-north-1"))
s3(region).contentType("application/xml").body(constraint(region))
.put("/" + bucket).then().statusCode(200);
deleteLater("cn-north-1", bucket);
deleteLater(region, bucket);
s3("cn-north-1").get("/" + bucket + "?location").then().statusCode(200)
.body(containsString(">cn-north-1</LocationConstraint>"));
s3(region).get("/" + bucket + "?location").then().statusCode(200)
.body(containsString(">" + region + "</LocationConstraint>"));
s3("cn-north-1").contentType("application/xml").body(constraint("cn-north-1"))
s3(region).contentType("application/xml").body(constraint(region))
.put("/" + bucket).then().statusCode(409)
.body(containsString("<Code>BucketAlreadyOwnedByYou</Code>"));
}
@@ -24,6 +24,10 @@ public final class PartitionMatrix {
public static final String ACCOUNT = "000000000000";
/** The {@code @MethodSource} name of {@link #nonCommercialCases()}. */
public static final String NON_COMMERCIAL_CASES =
"io.github.hectorvent.floci.testing.PartitionMatrix#nonCommercialCases";
private static final List<PartitionCase> ALL = List.of(
new PartitionCase("aws", "us-east-1", "amazonaws.com"),
new PartitionCase("aws-cn", "cn-north-1", "amazonaws.com.cn"),
@@ -46,6 +50,11 @@ public final class PartitionMatrix {
return ALL.stream();
}
/** Every case but the commercial one; for {@code @MethodSource(PartitionMatrix.NON_COMMERCIAL_CASES)}. */
public static Stream<PartitionCase> nonCommercialCases() {
return ALL.stream().filter(c -> !"aws".equals(c.partition()));
}
/** A SigV4 Authorization header whose credential scope signs {@code region} for {@code service}. */
public static String sigV4Auth(String region, String service) {
return "AWS4-HMAC-SHA256 Credential=AKID/20260215/" + region + "/" + service + "/aws4_request, "