diff --git a/.changes/unreleased/BUG FIXES-20240229-095804.yaml b/.changes/unreleased/BUG FIXES-20240229-095804.yaml new file mode 100644 index 000000000..0db59ca8c --- /dev/null +++ b/.changes/unreleased/BUG FIXES-20240229-095804.yaml @@ -0,0 +1,6 @@ +kind: BUG FIXES +body: 'helper/resource: Fixed internal deferred test helpers to properly report file + and line information in test failures.' +time: 2024-02-29T09:58:04.443444-05:00 +custom: + Issue: "292" diff --git a/helper/resource/testing_new.go b/helper/resource/testing_new.go index 2464e3cc7..0a7c7e7f7 100644 --- a/helper/resource/testing_new.go +++ b/helper/resource/testing_new.go @@ -63,6 +63,8 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest } defer func() { + t.Helper() + var statePreDestroy *terraform.State var err error err = runProviderCommand(ctx, t, func() error { @@ -558,6 +560,8 @@ func testIDRefresh(ctx context.Context, t testing.T, c TestCase, wd *plugintest. } defer func() { + t.Helper() + confRequest := teststep.PrepareConfigurationRequest{ Directory: step.ConfigDirectory, File: step.ConfigFile,