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.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-02 09:28:41 -04:00
1 parent 0460e51a6e
commit c800cc375e
2 files changed
+7 -9

No files matched your search

@@ -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