-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Closed
Description
Proposal
Use case. Why is this important?
Instead of writing the code below in many many unit tests:
dir, err := ioutil.TempDir("", "wal_fuzz_live")
require.NoError(t, err)
defer func() {
require.NoError(t, os.RemoveAll(dir))
}()Write this instead:
dir := t.TempDir()Advantages:
- Error handling is implicit.
- Cleanup is implicit.
- Naming of directory derives from name of test, again, implicit.
Current occurences:
0 ✓ (40.6ms) 11:11:22 invidian@dellxps15mateusz ~/repos/prometheus (⎇ main)$ git show --no-patch
commit a6e6011d55ed913cb8e53968cead9a6a6fd84911 (HEAD -> main, upstream/main, upstream/HEAD)
Author: Furkan Türkal <furkan.turkal@trendyol.com>
Date: Mon Oct 25 00:45:31 2021 +0300
Add scrape_body_size_bytes metric (#9569)
Fixes #9520
Signed-off-by: Furkan <furkan.turkal@trendyol.com>
0 ✓ (37.3ms) 11:11:29 invidian@dellxps15mateusz ~/repos/prometheus (⎇ main)$ git grep ioutil.TempDir *_test.go | wc -l
129Reactions are currently unavailable