From 1ceee96fc4e1a89314255ded91666009581f73dc Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Mon, 15 Aug 2022 21:09:18 +0800 Subject: [PATCH] server: use `T.TempDir` to create temporary test directory Signed-off-by: Eng Zer Jun --- server_test.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server_test.go b/server_test.go index eb36026b4..41954d1c1 100644 --- a/server_test.go +++ b/server_test.go @@ -15,7 +15,6 @@ import ( "io/ioutil" "math/big" "net" - "os" "testing" "time" @@ -27,11 +26,7 @@ import ( // new TLS certificate pair is regenerated when the old pair expires. This is // necessary because the pair expires after a little over a year. func TestTLSAutoRegeneration(t *testing.T) { - tempDirPath, err := ioutil.TempDir("", ".testLnd") - if err != nil { - t.Fatalf("couldn't create temporary cert directory") - } - defer os.RemoveAll(tempDirPath) + tempDirPath := t.TempDir() certPath := tempDirPath + "/tls.cert" keyPath := tempDirPath + "/tls.key"