diff options
author | 2023-06-17 21:21:01 +0800 | |
---|---|---|
committer | 2023-06-17 15:21:01 +0200 | |
commit | b868350fc2823f429cc828558f3425d5135e680f (patch) | |
tree | ab6af66c78d1d0ca1c5bf289d6664317af3a397b /test/erratic_autopath_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 'test/erratic_autopath_test.go')
-rw-r--r-- | test/erratic_autopath_test.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/test/erratic_autopath_test.go b/test/erratic_autopath_test.go index 1c6364a09..0e7b20eb0 100644 --- a/test/erratic_autopath_test.go +++ b/test/erratic_autopath_test.go @@ -9,11 +9,7 @@ import ( ) func setupProxyTargetCoreDNS(t *testing.T, fn func(string)) { - tmpdir, err := os.MkdirTemp(os.TempDir(), "coredns") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmpdir) + tmpdir := t.TempDir() content := ` example.org. IN SOA sns.dns.icann.org. noc.dns.icann.org. 1 3600 3600 3600 3600 @@ -23,7 +19,7 @@ google.com. IN A 172.217.25.110 ` path := filepath.Join(tmpdir, "file") - if err = os.WriteFile(path, []byte(content), 0644); err != nil { + if err := os.WriteFile(path, []byte(content), 0644); err != nil { t.Fatalf("Could not write to temp file: %s", err) } defer os.Remove(path) |