pulumi/sdk/go/common/workspace
Eng Zer Jun 48eff4676a
test: use T.TempDir to create temporary test directory
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-12-03 15:17:08 +08:00
..
config.go typing made optional in hierarchical config and relaxed stack config validation 2022-10-30 23:42:39 +01:00
creds.go ci: gofmt 1.18+ clean 2022-09-21 09:48:39 -07:00
creds_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
loaders.go Allow project to be nil when namespacing project stack config 2022-10-12 16:23:16 +02:00
paths.go Apply project config to stack config when appropriate 2022-09-21 15:52:14 +02:00
paths_test.go test: use T.TempDir to create temporary test directory 2022-12-03 15:17:08 +08:00
plugins.go Remove traverse errors on dynamic types 2022-11-16 14:41:30 -08:00
plugins_install_nodejs_test.go ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
plugins_install_python_test.go ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
plugins_install_test.go test: use T.TempDir to create temporary test directory 2022-12-03 15:17:08 +08:00
plugins_test.go test: use T.TempDir to create temporary test directory 2022-12-03 15:17:08 +08:00
project.go typing made optional in hierarchical config and relaxed stack config validation 2022-10-30 23:42:39 +01:00
project.json typing made optional in hierarchical config and relaxed stack config validation 2022-10-30 23:42:39 +01:00
project_test.go typing made optional in hierarchical config and relaxed stack config validation 2022-10-30 23:42:39 +01:00
settings.go move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
templates.go Do not fail pulumi policy new on invalid template(s) 2022-11-22 17:14:35 -08:00
templates_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
workspace.go Improve corrupt workspace settings experience (#8393) 2021-11-11 14:58:39 -08:00