aws-ia / taskcat

Test all the CloudFormation things! (with TaskCat)
https://aws-ia.github.io/taskcat/
Apache License 2.0
1.16k stars 213 forks source link

Taskcat test clean gives a template deleted return while template hasn't fully completed deletion #809

Closed gcasilva closed 11 months ago

gcasilva commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Taskcat test clean command should return that the cloudformation template has been deleted only after Cloudformation deletion has completed. This causes issues when you execute taskcat test run command again afterwards in a shell script for example as you can run into racing conditions where the new taskcat test won't be able to be completed because previous resources that shouldn't exist are conflicting since they haven't been deleted by Cloudformation completely yet. Only solution is to create sleep timers in your shell script, which isn't optimal as one needs to know how long it takes for the cloudformation template to complete.

To Reproduce Steps to reproduce the behavior:

  1. Are you testing a QuickStart or Custom template? Custom template
  2. Attach or link a copy of the template if possible (remove any sensitive info)
  3. Provide the parameters that you passed. (remove any sensitive info) taskcat test clean
  4. How did you install taskcat? (docker or pip3) pip
  5. Are you using a profile, an instance role or access keys to run taskcat? instance role
  6. Is your AWS environment configured via aws configure? no

Expected behavior A clear and concise description of what you expected to happen. Taskcat test clean command should return that the cloudformation template has been deleted only after Cloudformation deletion has completed.

Screenshots If applicable, add screenshots to help explain your problem.

**Version (Please make sure you are running the latest version of taskcat)

To find versions: Via taskcat: taskcat -V Via pip3: pip3 show taskcat

Note: both version should match

To update taskcat run: for docker : docker pull taskcat/taskcat for pip3: pip3 install --upgrade taskcat

Additional context Add any other context about the problem here.

andrew-glenn commented 1 year ago

Hey @gcasilva - thanks for reporting this.

https://github.com/aws-ia/taskcat/blob/f2154c7dfdd2e60de0f4cc40f48a4e4f3928d06b/taskcat/_cfn/stack.py#L518-L522

Looks like we're not using a waiter here. This should be a straight forward fix.

gattasrikanth commented 1 year ago

This will be really useful for our use case too. Any ETA?

gcasilva commented 1 year ago

@andrew-glenn I was able to implement the fix for this and added a new PR for it if you can please review/approve it. https://github.com/aws-ia/taskcat/pull/811

andrew-glenn commented 11 months ago

I consider this issue now resolved. Please re-open if this resurfaces.