From 70cf13bc4cb61dc35f3bbdb2d36793f8a71683d3 Mon Sep 17 00:00:00 2001 From: Jackson Price <59149601+jprice8@users.noreply.github.com> Date: Sat, 28 Nov 2026 06:19:53 -0600 Subject: [PATCH] test(cloudformation): delete the alarm stack after the integration test (#9642) CloudFormationCloudWatchAlarmIntegrationTest left its stack and metric alarm in the shared emulator, where later tests could find them. The stack name is now a field, the alarm is named after it, and an @AfterEach deletes the stack through CfnStackWaits.deleteStack and waits for the deletion, even when an assertion fails. Co-authored-by: Andre Kurait Signed-off-by: Andre Kurait Signed-off-by: Jackson Price --- ...CloudFormationCloudWatchAlarmIntegrationTest.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCloudWatchAlarmIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCloudWatchAlarmIntegrationTest.java index b9a8286202..a750a7f70c 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCloudWatchAlarmIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCloudWatchAlarmIntegrationTest.java @@ -2,6 +2,7 @@ package io.floci.aws.services.cloudformation; import io.floci.aws.testing.CfnStackWaits; import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import static io.restassured.RestAssured.given; @@ -20,11 +21,16 @@ class CloudFormationCloudWatchAlarmIntegrationTest { private static final String CW_AUTH = "AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/monitoring/aws4_request"; + private final String stackName = "cfn-cw-alarm-stack-" + Long.toString(System.nanoTime(), 36); + + @AfterEach + void deleteStack() { + CfnStackWaits.deleteStack(stackName, CFN_AUTH); + } + @Test void createStackProvisionsAlarmVisibleToCloudWatch() { - String suffix = Long.toString(System.nanoTime(), 36); - String alarmName = "cfn-alarm-" + suffix; - String stackName = "cfn-cw-alarm-stack-" + suffix; + String alarmName = stackName + "-alarm"; String template = """ {