Skip to content

Commit 8c571ee

Browse files
paddycarverPaddy
authored andcommitted
Check the error on post-test destroy.
We were silently discarding the error instead of surfacing it when there was an error returned from our post-test destroy code responsible for tearing down infrastructure. Let's tell the user so they know infrastructure may be dangling, and can see what went wrong and ideally fix it. Fixes #571.
1 parent d5a54b6 commit 8c571ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

helper/resource/testing_new.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ func runNewTest(t testing.T, c TestCase, helper *tftest.Helper) {
6363
}
6464

6565
if !stateIsEmpty(statePreDestroy) {
66-
runPostTestDestroy(t, c, wd, c.ProviderFactories)
66+
err := runPostTestDestroy(t, c, wd, c.ProviderFactories)
67+
if err != nil {
68+
t.Fatalf("Error running post-test destroy, there may be dangling resources: %s", err.Error())
69+
}
6770
}
6871

6972
wd.Close()

0 commit comments

Comments
 (0)