From 45f0a7efd89b1aa92561c4cf14e8d8e30ad5f8e3 Mon Sep 17 00:00:00 2001 From: Nick Metz Date: Thu, 17 Jun 2021 16:50:17 +0200 Subject: [PATCH] change t.Fatal to require.NoError in TestInitReconfigureBackend and TestInitBackendMigration Signed-off-by: Nick Metz --- modules/terraform/init_test.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/modules/terraform/init_test.go b/modules/terraform/init_test.go index e985777c2..b376001dc 100644 --- a/modules/terraform/init_test.go +++ b/modules/terraform/init_test.go @@ -87,21 +87,17 @@ func TestInitReconfigureBackend(t *testing.T) { t.Parallel() stateDirectory, err := ioutil.TempDir("", t.Name()) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) defer os.RemoveAll(stateDirectory) testFolder, err := files.CopyTerraformFolderToTemp("../../test/fixtures/terraform-backend", t.Name()) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) defer os.RemoveAll(testFolder) options := &Options{ TerraformDir: testFolder, BackendConfig: map[string]interface{}{ - "path": filepath.Join(stateDirectory, "backend.tfstate"), + "path": filepath.Join(stateDirectory, "backend.tfstate"), "workspace_dir": "current", }, } @@ -121,21 +117,17 @@ func TestInitBackendMigration(t *testing.T) { t.Parallel() stateDirectory, err := ioutil.TempDir("", t.Name()) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) defer os.RemoveAll(stateDirectory) testFolder, err := files.CopyTerraformFolderToTemp("../../test/fixtures/terraform-backend", t.Name()) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) defer os.RemoveAll(testFolder) options := &Options{ TerraformDir: testFolder, BackendConfig: map[string]interface{}{ - "path": filepath.Join(stateDirectory, "backend.tfstate"), + "path": filepath.Join(stateDirectory, "backend.tfstate"), "workspace_dir": "current", }, } @@ -149,4 +141,4 @@ func TestInitBackendMigration(t *testing.T) { options.MigrateState = true _, err = InitE(t, options) assert.NoError(t, err, "Backend initialization with changed configuration should success with -migrate-state option") -} \ No newline at end of file +}