1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/pkg/cnbutils
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
..
bindings feat(cnbBuild): remove docker config after parsing (#3417) 2022-01-11 10:01:15 +01:00
privacy feat(cnbBuild): added dockerimage to the telemetry data (#3501) 2022-02-16 13:28:51 +01:00
project test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
registry feat(cnbBuild): added support for project.toml (#3163) 2021-10-11 11:10:21 +02:00
auth_test.go feat(cnbBuild): Support of username/password authorization (#3690) 2022-03-31 16:13:21 +02:00
auth.go feat(cnbBuild): Support of username/password authorization (#3690) 2022-03-31 16:13:21 +02:00
buildpack_test.go feat(cnbBuild): cache buildpacks during multi-image build (#3635) 2022-03-30 13:58:16 +02:00
buildpack.go feat(cnbBuild): cache buildpacks during multi-image build (#3635) 2022-03-30 13:58:16 +02:00
copy_project_test.go feat(cnbBuild) Introducing preserveFiles config to copy back files (#3562) 2022-02-23 18:54:59 +01:00
copy_project.go feat(cnbBuild) Introducing preserveFiles config to copy back files (#3562) 2022-02-23 18:54:59 +01:00
env_test.go feat(cnbBuild): remove docker config after parsing (#3417) 2022-01-11 10:01:15 +01:00
env.go feat(cnbBuild): refactored buildEnvVars input property, added resourceRef to the buildpacks (#3310) 2021-11-29 11:32:32 +01:00
mock.go feat(cnbBuild): cache buildpacks during multi-image build (#3635) 2022-03-30 13:58:16 +02:00
order_test.go feat(cnbBuild): remove docker config after parsing (#3417) 2022-01-11 10:01:15 +01:00
order.go feat(cnbBuild): increased platform api compatibility (#3330) 2021-12-07 14:06:35 +01:00
report_test.go feat(cnbBuild): write image digests to the CPE (#3602) 2022-03-02 16:26:45 +01:00
report.go feat(cnbBuild): cache buildpacks during multi-image build (#3635) 2022-03-30 13:58:16 +02:00
target_image_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
target_image.go feat(cnbBuild) read target image name from github cpe (#3620) 2022-03-09 14:06:26 +01:00
utils.go Cnb build custom buildpacks (#3090) 2021-09-14 16:14:50 +02:00