From 7a2ebb934ad7908973eedad67ff1fe8bd4dfcc86 Mon Sep 17 00:00:00 2001 From: mrfelek Date: Thu, 12 Nov 2026 15:44:44 +0100 Subject: [PATCH] test(cloudformation): wait for a deferred delete by its DELETE_COMPLETE event (#8116) --- .../CloudFormationStackStatusEventsIntegrationTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationStackStatusEventsIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationStackStatusEventsIntegrationTest.java index 7d34f619ef..78db1b0e59 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationStackStatusEventsIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationStackStatusEventsIntegrationTest.java @@ -124,9 +124,10 @@ class CloudFormationStackStatusEventsIntegrationTest { executeChangeSet(root, "update", "b"); CfnStackWaits.awaitStatus(root, "UPDATE_COMPLETE"); + // A delete that lands before the update's execution has ended waits for it, so the stack can still show + // UPDATE_COMPLETE: the wait is for the delete's own DELETE_COMPLETE event. CfnRequests.cfn("DeleteStack", root).formParam("ClientRequestToken", "c") .when().post("/").then().statusCode(200); - CfnStackWaits.awaitStatus(rootId, "DELETE_COMPLETE"); List events = awaitEvents(queue, rootId, "DELETE_COMPLETE"); List rootEvents = naming(events, rootId); @@ -164,8 +165,9 @@ class CloudFormationStackStatusEventsIntegrationTest { CfnRequests.cfn("DeleteStack", stack).formParam("ClientRequestToken", "delete-token") .when().post("/").then().statusCode(200); heldCreate.release(); - CfnStackWaits.awaitStatus(stackId, "DELETE_COMPLETE"); + // The delete starts once the create ends, so the stack shows CREATE_COMPLETE in between: the wait is for + // the delete's own DELETE_COMPLETE event, not a status a poll could catch at CREATE_COMPLETE. List events = naming(awaitEvents(queue, stackId, "DELETE_COMPLETE"), stackId); Map> tokens = tokensByStatus(events); assertEquals(Set.of("create-token"), tokens.get("CREATE_IN_PROGRESS"));