Cleanup functions should run regardless of whether or not their step function succeeded
Given a step with function foo
, and cleanup function foo_cleanup
, should foo_cleanup
be called, if foo
fails?
I think it should, to handle cases where foo
does some things, but then fails. Ideally foo
would clean up after itself upon failure, but it'd be more ergonomic to not require that. foo_cleanup
needs to be written in a way that can it works even if only some of the things it's cleaning up are there.
Specific case that triggered this: foo
starts a virtual machine, but can fail after it's already running. foo_cleanup
doesn't get run, and as a result the VM is still there after the Subplot-generated test program finishes.
Edited by Daniel Silverstone