1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/http
Eng Zer Jun 0f4e30e9db
test: use T.TempDir to create temporary test directory (#3721)
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>

Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2022-07-12 15:19:12 +02:00
..
downloader_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
downloader.go feat(kubernetesDeploy): add infrastructure extensibility (#3853) 2022-06-29 12:00:37 +02:00
http_test.go chore: update to go 1.17 (#3557) 2022-03-07 17:15:36 +01:00
http.go fix(orchestrator) usage of correct env variables (#3650) 2022-03-28 09:52:15 +02:00