From 6f83fcd935fc3d468780c6c5f2b3e3c9f16cb8d4 Mon Sep 17 00:00:00 2001 From: Paddy Carver Date: Sat, 12 Sep 2020 03:09:09 -0700 Subject: [PATCH] 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. --- helper/resource/testing_new.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helper/resource/testing_new.go b/helper/resource/testing_new.go index 72050285da..189adeed70 100644 --- a/helper/resource/testing_new.go +++ b/helper/resource/testing_new.go @@ -63,7 +63,10 @@ func runNewTest(t testing.T, c TestCase, helper *tftest.Helper) { } if !stateIsEmpty(statePreDestroy) { - runPostTestDestroy(t, c, wd, c.ProviderFactories) + err := runPostTestDestroy(t, c, wd, c.ProviderFactories) + if err != nil { + t.Fatalf("Error running post-test destroy, there may be dangling resources: %s", err.Error()) + } } wd.Close()