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
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-19 07:00:30 -04:00
1 parent fb59000838
commit 3b695e25d2
7 files changed
+28 -7

No files matched your search

@@ -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();
@@ -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
@@ -926,7 +926,7 @@ class GlueSchemaRegistryTest {
Map<String, Object> 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);
@@ -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<String> 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();
@@ -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(
@@ -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");
}