aboutsummaryrefslogtreecommitdiff
path: root/plugin/auto/watcher_test.go
diff options
context:
space:
mode:
authorGravatar Eng Zer Jun <engzerjun@gmail.com> 2023-06-17 21:21:01 +0800
committerGravatar GitHub <noreply@github.com> 2023-06-17 15:21:01 +0200
commitb868350fc2823f429cc828558f3425d5135e680f (patch)
treeab6af66c78d1d0ca1c5bf289d6664317af3a397b /plugin/auto/watcher_test.go
parent06cd8439182be8b9ed17280eaae411f9afb7c8f2 (diff)
downloadcoredns-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.go12
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,