Merge pull request #41 from breezy-bytes/feature/cloudformation-add-delete-change-set

feat: add support for DeleteChangeSet in CloudFormation
This commit is contained in:
Juan Diego López authored and GitHub committed 2026-03-24 13:39:36 -04:00
commit e05b7ec7be
4 files changed
+176

No files matched your search

@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
@QuarkusTest
class CloudFormationIntegrationTest {
@@ -73,4 +74,122 @@ class CloudFormationIntegrationTest {
.body(containsString("<StackName>test-stack</StackName>"))
.body(containsString("<StackStatus>CREATE_COMPLETE</StackStatus>"));
}
@Test
void deleteChangeSet_removesChangeSet() {
String template = """
{
"Resources": {
"MyBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "cs-delete-test-bucket"
}
}
}
}
""";
// 1. Create a ChangeSet (implicitly creates the stack)
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "CreateChangeSet")
.formParam("StackName", "cs-delete-stack")
.formParam("ChangeSetName", "my-changeset")
.formParam("ChangeSetType", "CREATE")
.formParam("TemplateBody", template)
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<Id>"));
// 2. Verify ChangeSet exists
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeChangeSet")
.formParam("StackName", "cs-delete-stack")
.formParam("ChangeSetName", "my-changeset")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<ChangeSetName>my-changeset</ChangeSetName>"));
// 3. Delete the ChangeSet
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DeleteChangeSet")
.formParam("StackName", "cs-delete-stack")
.formParam("ChangeSetName", "my-changeset")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<DeleteChangeSetResult/>"));
// 4. Verify ChangeSet no longer exists
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeChangeSet")
.formParam("StackName", "cs-delete-stack")
.formParam("ChangeSetName", "my-changeset")
.when()
.post("/")
.then()
.statusCode(400)
.body(containsString("ChangeSetNotFoundException"));
// 5. Verify ChangeSet is absent from ListChangeSets
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "ListChangeSets")
.formParam("StackName", "cs-delete-stack")
.when()
.post("/")
.then()
.statusCode(200)
.body(not(containsString("my-changeset")));
}
@Test
void deleteChangeSet_nonExistentChangeSet_returnsError() {
String template = """
{
"Resources": {
"MyBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "cs-error-test-bucket"
}
}
}
}
""";
// Create a stack via CreateChangeSet so the stack exists
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "CreateChangeSet")
.formParam("StackName", "cs-error-stack")
.formParam("ChangeSetName", "existing-changeset")
.formParam("ChangeSetType", "CREATE")
.formParam("TemplateBody", template)
.when()
.post("/")
.then()
.statusCode(200);
// Attempt to delete a changeset that does not exist
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DeleteChangeSet")
.formParam("StackName", "cs-error-stack")
.formParam("ChangeSetName", "nonexistent-changeset")
.when()
.post("/")
.then()
.statusCode(400)
.body(containsString("ChangeSetNotFoundException"));
}
}