Skip to content

Commit

Permalink
change t.Fatal to require.NoError in TestInitReconfigureBackend and T…
Browse files Browse the repository at this point in the history
…estInitBackendMigration

Signed-off-by: Nick Metz <[email protected]>
  • Loading branch information
Nick Metz committed Jun 19, 2021
1 parent 62d3fb4 commit 45f0a7e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions modules/terraform/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
Expand All @@ -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",
},
}
Expand All @@ -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")
}
}

0 comments on commit 45f0a7e

Please sign in to comment.