Skip to content

Commit

Permalink
explain why clean temp dir is used
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Jun 22, 2022
1 parent 82aee70 commit 66fbb39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tfexec/internal/e2etest/util_test.go
Expand Up @@ -46,6 +46,11 @@ func runTest(t *testing.T, fixtureName string, cb func(t *testing.T, tfVersion *
// valid Terraform executable, only tests appropriate to that
// executable's version will be run.
if localBinPath := os.Getenv("TFEXEC_E2ETEST_TERRAFORM_PATH"); localBinPath != "" {
// By convention, every new Terraform struct is given a clean
// temp dir, even if we are only invoking tf.Version(). This
// prevents any possible confusion that could result from
// reusing an os.TempDir() (for example) that already contained
// Terraform files.
td, err := ioutil.TempDir("", "tf")
if err != nil {
t.Fatalf("error creating temporary test directory: %s", err)
Expand Down

0 comments on commit 66fbb39

Please sign in to comment.