diff options
author | 2023-06-17 21:21:01 +0800 | |
---|---|---|
committer | 2023-06-17 15:21:01 +0200 | |
commit | b868350fc2823f429cc828558f3425d5135e680f (patch) | |
tree | ab6af66c78d1d0ca1c5bf289d6664317af3a397b /plugin/auto/watcher_test.go | |
parent | 06cd8439182be8b9ed17280eaae411f9afb7c8f2 (diff) | |
download | coredns-b868350fc2823f429cc828558f3425d5135e680f.tar.gz coredns-b868350fc2823f429cc828558f3425d5135e680f.tar.zst coredns-b868350fc2823f429cc828558f3425d5135e680f.zip |
test: use `t.TempDir` to create temporary test directory (#6164)
Diffstat (limited to 'plugin/auto/watcher_test.go')
-rw-r--r-- | plugin/auto/watcher_test.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/plugin/auto/watcher_test.go b/plugin/auto/watcher_test.go index 43f1ff374..9a256f443 100644 --- a/plugin/auto/watcher_test.go +++ b/plugin/auto/watcher_test.go @@ -8,14 +8,10 @@ import ( ) func TestWatcher(t *testing.T) { - tempdir, err := createFiles() + tempdir, err := createFiles(t) if err != nil { - if tempdir != "" { - os.RemoveAll(tempdir) - } t.Fatal(err) } - defer os.RemoveAll(tempdir) ldr := loader{ directory: tempdir, @@ -54,14 +50,10 @@ func TestWatcher(t *testing.T) { } func TestSymlinks(t *testing.T) { - tempdir, err := createFiles() + tempdir, err := createFiles(t) if err != nil { - if tempdir != "" { - os.RemoveAll(tempdir) - } t.Fatal(err) } - defer os.RemoveAll(tempdir) ldr := loader{ directory: tempdir, |