opentofu/internal/initwd
Eng Zer Jun fedd315275
test: use T.TempDir to create temporary test directory (#30803)
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-08 17:34:16 +01:00
..
testdata initwd: Error message for local paths escaping module packages 2021-05-27 11:00:43 -07:00
doc.go command: "terraform init" can partially initialize for 0.12upgrade 2019-01-14 11:33:21 -08:00
from_module_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
from_module.go command: make module installation interruptible 2021-11-11 12:28:10 +00:00
load_config.go Move tfdiags/ to internal/tfdiags/ 2021-05-17 14:09:07 -07:00
module_install_hooks.go Move module install functionality over to internal/initwd 2019-01-14 11:33:21 -08:00
module_install_test.go addrs: Expose the registry address parser's error messages 2021-11-30 15:46:16 -08:00
module_install.go addrs: Expose the registry address parser's error messages 2021-11-30 15:46:16 -08:00
testing.go command: make module installation interruptible 2021-11-11 12:28:10 +00:00