Skip to content

Commit

Permalink
Honor RemoveAll defer
Browse files Browse the repository at this point in the history
  • Loading branch information
paultyng committed Jul 11, 2020
1 parent fd57643 commit 014f135
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tfexec/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ const testTerraformStateFileName = "terraform.tfstate"
var tfPath string

func TestMain(m *testing.M) {
var err error
td, err := ioutil.TempDir("", "tfinstall")
if err != nil {
panic(err)
}
defer os.RemoveAll(td)

tfPath, err = tfinstall.Find(tfinstall.LookPath(), tfinstall.LatestVersion(td, true))
if err != nil {
panic(err)
}
exitCode := m.Run()
os.Exit(exitCode)

os.Exit(func() int {
var err error
td, err := ioutil.TempDir("", "tfinstall")
if err != nil {
panic(err)
}
defer os.RemoveAll(td)

tfPath, err = tfinstall.Find(tfinstall.LookPath(), tfinstall.LatestVersion(td, true))
if err != nil {
panic(err)
}
return m.Run()
}())
}

func TestCheckpointDisablePropagation(t *testing.T) {
Expand Down

0 comments on commit 014f135

Please sign in to comment.