1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/versioning
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
..
descriptorUtils_test.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
descriptorUtils.go refactor(versioning): simplify versioning model method (#2825) 2021-05-14 09:35:31 +02:00
docker_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
docker.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
gomodfile.go Golang build publish binaries and add group id (#3749) 2022-05-05 12:39:59 +02:00
gradle_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
gradle.go feat(gradleExecuteBuild, fortifyExecuteScan): gradle improvements (#3807) 2022-06-07 10:24:10 +02:00
helm_test.go feat(artifactPrepareVersion): helm & propagate version (#3627) 2022-03-15 09:08:24 +01:00
helm.go feat(artifactPrepareVersion): helm & propagate version (#3627) 2022-03-15 09:08:24 +01:00
inifile_test.go artifactPrepareVersioning: support more buildTools (#1367) 2020-04-15 13:12:43 +02:00
inifile.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
jsonfile_test.go artifactPrepareVersioning: support more buildTools (#1367) 2020-04-15 13:12:43 +02:00
jsonfile.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
maven_test.go Refactor maven utils and add tests for install artifacts (#2318) 2020-11-10 17:14:55 +01:00
maven.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
pip_test.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
pip.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
properties_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
properties.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
versionfile_test.go artifactPrepareVersioning: support more buildTools (#1367) 2020-04-15 13:12:43 +02:00
versionfile.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00
versioning_test.go fix(versioning): properly consider go.mod (#3687) 2022-03-31 17:07:10 +02:00
versioning.go feat(gradleExecuteBuild, fortifyExecuteScan): gradle improvements (#3807) 2022-06-07 10:24:10 +02:00
versioningModel_test.go refactor(versioning): simplify versioning model method (#2825) 2021-05-14 09:35:31 +02:00
versioningModel.go refactor(versioning): simplify versioning model method (#2825) 2021-05-14 09:35:31 +02:00
yamlfile_test.go Implement YAMLfile.GetCooridnates() (#1604) 2020-05-27 17:20:34 +02:00
yamlfile.go feat(whitesource): consolidated reporting and versioning alignment (#2571) 2021-02-10 16:18:00 +01:00