From c800cc375e2ea0c8f9851ade7eb0c8de00c08315 Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Fri, 2 Oct 2026 08:28:41 -0500 Subject: [PATCH] test(compat): keep the China nightly allowlist free of an order-dependent entry (#4891) The first Partition Compatibility run (36963820252) went red on one stale entry: SsoAdminAccountAssignmentTest#createInstanceQuotaUsesAwsSdk passed. It only fails when OrganizationsTest#testFullLifecycle leaves its organization behind, which made the caller the management account for every later test, and that happened because the organization's own assertions, including the arn:aws: one that fails in cn-north-1, ran before the try whose finally deletes it. The assertions now run inside the try, so the organization is deleted however they end, and the stale entry is gone from the cn-north-1 allowlist. Part of #4272. --- .github/ci/compat-partition-allowlist-cn-north-1.txt | 4 ---- .../test/java/com/floci/test/OrganizationsTest.java | 12 +++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/ci/compat-partition-allowlist-cn-north-1.txt b/.github/ci/compat-partition-allowlist-cn-north-1.txt index 91a1f22e50..3cb7bd075a 100644 --- a/.github/ci/compat-partition-allowlist-cn-north-1.txt +++ b/.github/ci/compat-partition-allowlist-cn-north-1.txt @@ -112,7 +112,3 @@ S3Test#deleteEuBucket S3Test#getBucketLocationEuCentral1 StsTest#assumeRoleWithSaml StsTest#assumeRoleWithSamlAssumedRoleUser - -# Passes alone: in the full run OrganizationsTest#testFullLifecycle fails its arn:aws: assertion -# before cleanup, leaving the caller as the Organizations management account. -SsoAdminAccountAssignmentTest#createInstanceQuotaUsesAwsSdk 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 5284b4729e..f7006ac749 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 @@ -61,14 +61,16 @@ public class OrganizationsTest { // 1. Create the organization. Organization organization = client.createOrganization(r -> r.featureSet(OrganizationFeatureSet.ALL)) .organization(); - assertThat(organization.id()).matches("o-[a-z0-9]{10}"); - assertThat(organization.featureSet()).isEqualTo(OrganizationFeatureSet.ALL); - assertThat(organization.arn()).startsWith("arn:aws:organizations::"); - assertThat(organization.masterAccountId()).isNotBlank(); - String managementAccountId = organization.masterAccountId(); + // Every assertion runs inside the try, so a failure still deletes the organization: one left + // behind makes the caller its management account for every later test in the run. try { + assertThat(organization.id()).matches("o-[a-z0-9]{10}"); + assertThat(organization.featureSet()).isEqualTo(OrganizationFeatureSet.ALL); + assertThat(organization.arn()).startsWith("arn:aws:organizations::"); + assertThat(managementAccountId).isNotBlank(); + assertThat(client.describeOrganization().organization().id()).isEqualTo(organization.id()); // 2. The root exists with no policy types enabled, and carries the AWS-managed