opentofu/internal/providercache
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 providercache: More exhaustive testing of the main installer 2020-10-28 07:46:45 -07:00
cached_provider_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
cached_provider.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
dir_modify_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
dir_modify.go command/init: Read, respect, and update provider dependency locks 2020-10-09 09:26:23 -07:00
dir_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
dir.go tools: remove terraform-bundle. (#28876) 2021-06-03 14:08:04 -04:00
doc.go providercache: A package to encapsulate management of provider cache dirs 2020-03-25 11:29:48 -07:00
installer_events_test.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
installer_events.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
installer_test.go test: use T.TempDir to create temporary test directory (#30803) 2022-04-08 17:34:16 +01:00
installer.go providercache: Discard lock entries for unused providers 2021-12-17 15:30:21 -08:00
package_install.go Move httpclient/ to internal/httpclient/ 2021-05-17 14:09:07 -07:00