test(cloudformation): cover prefix list shrink rollback and entry removal (#6570)

Preserve capacity, version and entries after a rejected shrink, and clear omitted declared entries while retaining identity and capacity. Extend the accepted lifecycle fixture without changing production behavior.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-25 23:25:05 -04:00
1 parent 0e955cf07b
commit 0c71026a9f
1 file changed
+18
@@ -192,6 +192,15 @@ class CloudFormationEc2NetworkingIntegrationTest {
list = prefixListXml(id);
assertTrue(list.contains("<maxEntries>3</maxEntries>") && list.contains("<version>3</version>"), list);
cloudFormation(PREFIX_LIST_STACK, "UpdateStack", prefixListTemplate(vpcId, "IPv4", 1, offices, team, false));
describeStacks(PREFIX_LIST_STACK, "UPDATE_ROLLBACK_COMPLETE");
list = prefixListXml(id);
assertTrue(list.contains("<maxEntries>3</maxEntries>") && list.contains("<version>3</version>"),
"shrinking below the entry count must preserve capacity and version: " + list);
assertEquals(XmlParser.extractPairs(entries, "item", "cidr", "description"),
XmlParser.extractPairs(entriesXml(id), "item", "cidr", "description"),
"a rejected shrink must preserve both entries");
// Capacity and entries together, and another address family, fail the update and change nothing.
cloudFormation(PREFIX_LIST_STACK, "UpdateStack", prefixListTemplate(vpcId, "IPv4", 4, office, team, false));
describeStacks(PREFIX_LIST_STACK, "UPDATE_ROLLBACK_COMPLETE");
@@ -237,6 +246,15 @@ class CloudFormationEc2NetworkingIntegrationTest {
describeStacks(PREFIX_LIST_STACK, "UPDATE_COMPLETE");
assertFalse(prefixListXml(id).contains("<key>team</key>"), "the dropped tags must be removed");
String withoutEntries = prefixListTemplate(vpcId, "IPv4", 3, offices, "", false)
.replace(", \"Entries\": " + offices, "")
.replace("\"office-egress\"", "\"office-egress-renamed\"");
cloudFormation(PREFIX_LIST_STACK, "UpdateStack", withoutEntries);
assertEquals(id, XmlParser.extractPairs(describeStacks(PREFIX_LIST_STACK, "UPDATE_COMPLETE"),
"Outputs", "OutputKey", "OutputValue").get("Ref"));
assertFalse(entriesXml(id).contains("<cidr>"), "dropping declared Entries must clear the list");
assertTrue(prefixListXml(id).contains("<maxEntries>3</maxEntries>"), "omitting Entries preserves capacity");
cloudFormation(PREFIX_LIST_STACK, "DeleteStack", null);
CfnStackWaits.awaitStackDeleted(PREFIX_LIST_STACK);
given().contentType("application/x-www-form-urlencoded").header("Authorization", EC2_AUTH)