1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/pkg/config
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
..
interpolation (Vault) Improvements (#2439) 2021-02-15 09:48:51 +01:00
mocks add token revocation (#2686) 2021-03-10 08:36:50 +01:00
validation Add helper for finding uninitialized config (#2534) 2021-01-25 12:58:43 +01:00
config_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
config.go (fix) match regexes in sliceContains to support vaultSecretNames (#3618) 2022-03-17 09:41:51 +01:00
defaults_test.go Provide first parts for golang implementation (#905) 2019-10-22 15:41:27 +02:00
defaults.go Reading defaults in go: Make sure all io.ReadClosers are closed (#1529) 2020-05-12 15:46:47 +02:00
errors_test.go Provide first parts for golang implementation (#905) 2019-10-22 15:41:27 +02:00
errors.go Provide first parts for golang implementation (#905) 2019-10-22 15:41:27 +02:00
evaluation_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
evaluation.go feat (checkIfStepActive) including cpe conditions to check if a step is active / not active (#3642) 2022-03-17 12:09:16 +01:00
flags_test.go Provide first parts for golang implementation (#905) 2019-10-22 15:41:27 +02:00
flags.go Checkmarx as golang (#1075) 2020-01-27 23:40:53 +01:00
reporting_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
reporting.go feat(gcs): allow upload to gcs from steps (#3034) 2021-12-15 15:07:47 +01:00
resources.go Persisted pipeline environment for golang library (#1091) 2020-01-15 12:16:25 +01:00
run_test.go feat (checkIfStepActive) including cpe conditions to check if a step is active / not active (#3642) 2022-03-17 12:09:16 +01:00
run.go feat(getDefaults): add parameter for CRD-style config (#3736) 2022-04-19 12:34:40 +02:00
stepmeta_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
stepmeta.go fix(golangBuild): publishing of binaries (#3643) 2022-03-17 11:07:51 +01:00
vault_test.go Support custom general purpose vault credentials without prefix. (#3779) 2022-06-27 09:24:52 +02:00
vault.go Update vault.go (#3875) 2022-07-05 16:20:53 +02:00