1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/log
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
..
ansHook_test.go remove Pipeline word in subject (#3874) 2022-07-05 11:55:07 +03:00
ansHook.go remove Pipeline word in subject (#3874) 2022-07-05 11:55:07 +03:00
collectorHook_test.go feat(splunk) Sending telemetry and logging information to Splunk (#2796) 2021-05-17 12:14:04 +02:00
collectorHook.go feat(splunk) Sending telemetry and logging information to Splunk (#2796) 2021-05-17 12:14:04 +02:00
errors_test.go Reporting: Variable change to deprecate step Splunk Hook; logging in telemetry (#3539) 2022-02-14 08:56:11 +01:00
errors.go Reporting: Variable change to deprecate step Splunk Hook; logging in telemetry (#3539) 2022-02-14 08:56:11 +01:00
fatalHook_test.go test: use T.TempDir to create temporary test directory (#3721) 2022-07-12 15:19:12 +02:00
fatalHook.go Reporting: Variable change to deprecate step Splunk Hook; logging in telemetry (#3539) 2022-02-14 08:56:11 +01:00
log_test.go mask secret also when they are url encoded (#2289) 2020-11-02 10:08:34 +01:00
log.go chore(deprecation): change format of deprecation notice from config command (#2822) 2021-05-10 19:18:16 +02:00
sentryHook_test.go removed error level from sentry hook (#1528) 2020-05-12 22:11:52 +02:00
sentryHook.go Fix reading of hook configuration (#1854) 2020-07-28 17:19:33 +02:00
writer_test.go Fix logrus buffer issue (#1511) 2020-05-06 13:35:40 +02:00
writer.go Fix logrus buffer issue (#1511) 2020-05-06 13:35:40 +02:00