pulumi / pulumi-kubernetes-operator

A Kubernetes Operator that automates the deployment of Pulumi Stacks
Apache License 2.0
221 stars 55 forks source link

Expose failures to clean up after tests #342

Closed squaremo closed 1 year ago

squaremo commented 1 year ago

When stack objects aren't deleted after tests, it can mean

Previously, all stacks in the namespace were deleted as part of a top-level AfterEach; but because this tried to delete all stacks and wait until they'd been finalised, any rogue test case that didn't clean up properly and couldn't be finalised would cause some other test to time out.

The first commit here uses a similar idea, but fails the test suite if there are stacks left over at the very end. This highlighted a few problems, which I've also fixed here:

Deleting a stack but not waiting for it to be finalized, within a test, could mean other tests were "contaminated" (usually only meaning they might take a bit longer, and get cross-talk in the logs, but still). I've made all test cases use a helper which waits for the finalizers to have run.