From 3b695e25d26cbeeb00cc71834bb9f673d8b5440d Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Thu, 19 Nov 2026 05:00:30 -0600 Subject: [PATCH] test(compat): make the Java suite pass in every partition the nightly runs (#8958) * test(compat): make the Java suite pass in every partition the nightly runs --- .github/workflows/compat-partitions.yml | 1 + .../test/java/com/floci/test/AppSyncTest.java | 3 ++- .../java/com/floci/test/CodeBuildTest.java | 6 +++--- .../floci/test/GlueSchemaRegistryTest.java | 2 +- .../floci/test/PaymentCryptographyTest.java | 19 +++++++++++++++++++ .../test/java/com/floci/test/SignerTest.java | 2 +- .../test/java/com/floci/test/XrayTest.java | 2 +- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/compat-partitions.yml b/.github/workflows/compat-partitions.yml index 6592bae16d..d0cc03e232 100644 --- a/.github/workflows/compat-partitions.yml +++ b/.github/workflows/compat-partitions.yml @@ -90,6 +90,7 @@ jobs: -e FLOCI_SERVICES_IOT_MQTT_ENABLED=true \ -e FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ENABLED=true \ -e FLOCI_TLS_ENABLED=true \ + -e FLOCI_SERVICES_STEPFUNCTIONS_ALLOW_PLAINTEXT_HTTP=true \ -e FLOCI_SERVICES_EC2_MOCK=true \ -e FLOCI_SERVICES_REDSHIFT_ENDPOINT_HOST=floci \ -e FLOCI_SERVICES_RDS_ENDPOINT_HOST=floci \ diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java index 38f6f69575..e23d59d25a 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java @@ -1360,7 +1360,8 @@ class AppSyncTest { String url = TestFixtures.endpoint() + "/v1/apis/" + apiId + "/schemacreation"; HttpRequest req = HttpRequest.newBuilder() .uri(URI.create(url)) - .header("Authorization", "AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/appsync/aws4_request") + .header("Authorization", "AWS4-HMAC-SHA256 Credential=test/20260205/" + TestFixtures.region().id() + + "/appsync/aws4_request") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(body)) .build(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeBuildTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeBuildTest.java index c5abbaa932..a42dbcab64 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeBuildTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeBuildTest.java @@ -98,7 +98,7 @@ class CodeBuildTest { .image("aws/codebuild/standard:7.0") .computeType(ComputeType.BUILD_GENERAL1_SMALL) .build()) - .serviceRole("arn:aws:iam::000000000000:role/codebuild-role") + .serviceRole("arn:" + TestFixtures.partition() + ":iam::000000000000:role/codebuild-role") .tags(Tag.builder().key("env").value("test").build())); assertThat(resp.project().name()).isEqualTo("sdk-test-project"); @@ -233,7 +233,7 @@ class CodeBuildTest { .image(CODEBUILD_TEST_IMAGE) .computeType(ComputeType.BUILD_GENERAL1_SMALL) .build()) - .serviceRole("arn:aws:iam::000000000000:role/codebuild-role")); + .serviceRole("arn:" + TestFixtures.partition() + ":iam::000000000000:role/codebuild-role")); } @Test @@ -366,7 +366,7 @@ class CodeBuildTest { .image(CODEBUILD_TEST_IMAGE) .computeType(ComputeType.BUILD_GENERAL1_SMALL) .build()) - .serviceRole("arn:aws:iam::000000000000:role/codebuild-role")); + .serviceRole("arn:" + TestFixtures.partition() + ":iam::000000000000:role/codebuild-role")); } @Test diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueSchemaRegistryTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueSchemaRegistryTest.java index da9ffda61d..b2edb21135 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueSchemaRegistryTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/GlueSchemaRegistryTest.java @@ -926,7 +926,7 @@ class GlueSchemaRegistryTest { Map configs = new HashMap<>(); configs.put(AWSSchemaRegistryConstants.AWS_ENDPOINT, TestFixtures.endpoint().toString()); - configs.put(AWSSchemaRegistryConstants.AWS_REGION, "us-east-1"); + configs.put(AWSSchemaRegistryConstants.AWS_REGION, TestFixtures.region().id()); configs.put(AWSSchemaRegistryConstants.DATA_FORMAT, DataFormat.AVRO.name()); configs.put(AWSSchemaRegistryConstants.REGISTRY_NAME, registryName); configs.put(AWSSchemaRegistryConstants.SCHEMA_NAME, schemaName); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PaymentCryptographyTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PaymentCryptographyTest.java index 292c301f3f..f6536cd8ea 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PaymentCryptographyTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PaymentCryptographyTest.java @@ -65,6 +65,7 @@ import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * The Payment Cryptography control plane through the AWS SDK. @@ -151,6 +152,7 @@ class PaymentCryptographyTest { @Test void aKeyIsReplicatedToTheRegionsTheAccountReplicatesToByDefault() { + assumeReplicationRegions(); // The account's own default regions are read before the test changes them, so the // cleanup can put them back. List before = client.getDefaultKeyReplicationRegions(r -> { }) @@ -183,6 +185,7 @@ class PaymentCryptographyTest { @Test void theReplicationRegionsOfAKeyCanBeChanged() { + assumeReplicationRegions(); Key key = createReplicatedKey("us-west-2"); assertThat(key.multiRegionKeyType()).isEqualTo(MultiRegionKeyType.PRIMARY); @@ -202,6 +205,7 @@ class PaymentCryptographyTest { @Test void aRegionTheKeyAlreadyReplicatesIntoIsRefused() { + assumeReplicationRegions(); // Adding a region the key already replicates into changes nothing, and a request // that cannot be carried out is refused rather than answered with what it already was. Key key = createReplicatedKey("us-west-2"); @@ -213,6 +217,7 @@ class PaymentCryptographyTest { @Test void aRegionTheKeyDoesNotReplicateIntoIsRefused() { + assumeReplicationRegions(); // There is nothing to take away from a region the key does not replicate into. Key key = createReplicatedKey("us-west-2"); @@ -223,6 +228,7 @@ class PaymentCryptographyTest { @Test void takingTheLastReplicaAwayEndsTheReplication() { + assumeReplicationRegions(); // Taking the replica regions away is how the replication is turned off for a key, so // a key that replicates nowhere is not a multi-region key and says so by carrying no // type at all. @@ -241,6 +247,7 @@ class PaymentCryptographyTest { @Test void aKeyThatIsReplicatedHasToBeExportable() { + assumeReplicationRegions(); assertRefusedWithValidationException( () -> client.createKey(replicatedKeyRequest(false, "us-west-2")), "exportable"); @@ -282,6 +289,7 @@ class PaymentCryptographyTest { @Test void aKeyWhoseRegionsAreChangedHasAConfigurationOfItsOwn() { + assumeReplicationRegions(); // A key that took the account's default regions says so, and a key whose regions are // changed afterwards has a configuration of its own, so it says the other thing. Key key = createReplicatedKey("us-west-2"); @@ -381,6 +389,16 @@ class PaymentCryptographyTest { }; } + /** + * Skips a replication test outside the commercial partition: it replicates into us-west-2 and us-west-1, + * and a key replicates only within its own partition, where AWS GovCloud and China have one other region + * each and the European Sovereign Cloud none. + */ + private static void assumeReplicationRegions() { + assumeTrue("aws".equals(TestFixtures.partition()), + "replication tests name commercial regions; this run is in " + TestFixtures.partition()); + } + /** * A key of the data the cipher protects, replicated to the regions named. * @@ -593,6 +611,7 @@ class PaymentCryptographyTest { @Test void anImportedKeyIsReplicatedToTheRegionsTheRequestNames() { + assumeReplicationRegions(); // The model gives an import the same replication regions a creation does, so a key // that comes in can be replicated as soon as it lands. Key wrapping = createWrappingKey(); diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java index 2019456f1d..a84d2f14f8 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SignerTest.java @@ -75,7 +75,7 @@ class SignerTest { .build()) .tags(Map.of("env", "sdk"))); - assertThat(created.arn()).startsWith("arn:aws:signer:") + assertThat(created.arn()).startsWith("arn:" + TestFixtures.partition() + ":signer:") .endsWith(":/signing-profiles/" + PROFILE); assertThat(created.profileVersion()).hasSize(10); assertThat(created.profileVersionArn()).isEqualTo( diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/XrayTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/XrayTest.java index a6c77e621d..1524785360 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/XrayTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/XrayTest.java @@ -111,7 +111,7 @@ class XrayTest { assertThat(defaults.samplingRule().fixedRate()).isEqualTo(0.05); assertThat(defaults.samplingRule().reservoirSize()).isEqualTo(1); assertThat(defaults.samplingRule().resourceARN()) - .startsWith("arn:aws:xray:us-east-1:") + .startsWith("arn:" + TestFixtures.partition() + ":xray:" + TestFixtures.region().id() + ":") .endsWith(":sampling-rule/Default"); }