envato / cloudformation_rspec

Test your CloudFormation templates
MIT License
10 stars 0 forks source link

Test stacks aren't cleaned up when there is an error #11

Open HieronymusLex opened 5 years ago

HieronymusLex commented 5 years ago

if there is an error in a test (e.g. try reproducing https://github.com/envato/cloudformation_rspec/issues/10), the CFN stack does not get cleaned up and is left in state REVIEW_IN_PROGRESS.

I believe the issue is coming from https://github.com/envato/cloudformation_rspec/blob/master/lib/cloudformation_rspec/change_set.rb#L62 since the stack only gets deleted if it was actually created, which may not always be the case. Ideally the stack should always get deleted along with the changesets as it doesn't serve any purpose

patrobinson commented 5 years ago

I think what we want to do here is make the delete stack unconditional, by wrapping it in an ensure block and not raise any exceptions if we fail to delete the stack.

HieronymusLex commented 5 years ago

do you think we should at least log it though if the stack fails to delete so the user knows there's a manual intervention required to clean things up?

patrobinson commented 5 years ago

Yep