syncthing/lib
Eng Zer Jun bc27aa12cd
all: use T.TempDir to create temporary test directory (#8280)
This commit replaces `os.MkdirTemp` 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 `os.MkdirTemp`
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>
2022-04-15 07:44:06 +04:00
..
api all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
assets all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
beacon all: Unused args, retvals, assignments (#7926) 2021-09-08 00:11:16 +02:00
build all: Update build constraints to Go 1.17 style (#7894) 2021-08-17 10:10:41 +02:00
config all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
connections build: Bump quic-go to 0.26.0 for go1.18 update (#8231) 2022-04-12 16:27:29 +04:00
db lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
dialer lib: Removal global connection registry (#8254) 2022-04-09 16:04:56 +02:00
discover lib: Removal global connection registry (#8254) 2022-04-09 16:04:56 +02:00
events build: List go:generate tools in tools.go (#7599) 2021-05-08 12:52:06 +02:00
fs all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
ignore all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
locations Normalize CLI options to always use two dashes. (#8037) 2021-11-04 08:42:55 +01:00
logger all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
model all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
nat all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
osutil all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
pmp all: Replace errors.Cause with errors.Is (#8236) 2022-03-26 12:05:57 +02:00
protocol lib/protocol: Use one mutex for rawConnect.awaiting and nextID (#8198) 2022-02-28 09:13:30 +01:00
rand lib/rand: Optimizations (#7964) 2021-09-26 12:15:39 +02:00
rc all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
relay lib/relay: Send SNI when the address is a host name (fixes #8014) (#8015) 2021-11-22 08:31:03 +01:00
scanner all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
sha256 all: Use crypt/rand through its buffered version, but not in benchmarks (#7420) 2021-03-02 19:17:20 +01:00
signature all: Use crypt/rand through its buffered version, but not in benchmarks (#7420) 2021-03-02 19:17:20 +01:00
stats all: Truncate some timestamps (fixes #7457) (#7459) 2021-03-12 10:35:10 +01:00
stun lib/stun: Prevent nil deref when naming service (#7872) 2021-08-05 00:04:22 +01:00
svcutil lib/relay, lib/svcutil: Improve service logging (fixes #7580) (#7647) 2021-05-10 22:26:25 +02:00
sync lib/sync: Make the clock a function pointer 2021-11-27 15:35:07 +01:00
syncthing gui, lib/model: Mark folders unaccepted by remote device (fixes #8202) (#8201) 2022-04-10 22:47:57 +02:00
testutils lib: Use counterfeiter to mock interfaces in tests (#7375) 2021-03-03 08:53:50 +01:00
tlsutil lib/syncthing: Clean up / refactor LoadOrGenerateCertificate() utility function. (#8025) 2021-11-07 23:59:48 +01:00
upgrade lib/upgrade: Use strings.Reader instead of bytes.Buffer 2021-11-27 15:35:07 +01:00
upnp all: Replace errors.Cause with errors.Is (#8236) 2022-03-26 12:05:57 +02:00
ur lib/config: Decouple VerifyConfiguration from Committer (#7939) 2021-11-22 08:45:29 +01:00
util lib/connections: Fix and optimize registry (#7996) 2021-10-06 10:52:51 +02:00
versioner all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
watchaggregator lib: Fix panic due to closed event subscriptions on shutdown (#8079) 2021-12-22 20:16:21 +01:00
weakhash all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00