diff --git a/helper/resource/plugin.go b/helper/resource/plugin.go index 8e9c177c2a..9e52348d69 100644 --- a/helper/resource/plugin.go +++ b/helper/resource/plugin.go @@ -116,8 +116,9 @@ func runProviderCommand(ctx context.Context, t testing.T, f func() error, wd *pl // This should not happen, but prevent panics just in case. if factories == nil { - logging.HelperResourceError(ctx, "Provider factories are missing to run Terraform command. Please report this bug in the testing framework.") - t.Fatalf("Provider factories are missing to run Terraform command. Please report this bug in the testing framework.") + err := fmt.Errorf("Provider factories are missing to run Terraform command. Please report this bug in the testing framework.") + logging.HelperResourceError(ctx, err.Error()) + return err } // Run the providers in the same process as the test runner using the diff --git a/helper/resource/testing_new.go b/helper/resource/testing_new.go index 96f92e525b..4173911af4 100644 --- a/helper/resource/testing_new.go +++ b/helper/resource/testing_new.go @@ -193,7 +193,7 @@ func runNewTest(ctx context.Context, t testing.T, c TestCase, helper *plugintest if step.ImportState { logging.HelperResourceTrace(ctx, "TestStep is ImportState mode") - err := testStepNewImportState(ctx, t, c, helper, wd, step, appliedCfg, providers) + err := testStepNewImportState(ctx, t, helper, wd, step, appliedCfg, providers) if step.ExpectError != nil { logging.HelperResourceDebug(ctx, "Checking TestStep ExpectError") if err == nil { diff --git a/helper/resource/testing_new_import_state.go b/helper/resource/testing_new_import_state.go index 227245fdc6..ec61b055f3 100644 --- a/helper/resource/testing_new_import_state.go +++ b/helper/resource/testing_new_import_state.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) -func testStepNewImportState(ctx context.Context, t testing.T, c TestCase, helper *plugintest.Helper, wd *plugintest.WorkingDir, step TestStep, cfg string, providers *providerFactories) error { +func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest.Helper, wd *plugintest.WorkingDir, step TestStep, cfg string, providers *providerFactories) error { t.Helper() spewConf := spew.NewDefaultConfig()