server: use T.TempDir to create temporary test directory

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun 2022-08-15 21:09:18 +08:00
parent 6d00cdea45
commit 1ceee96fc4
No known key found for this signature in database
GPG Key ID: DAEBBD2E34C111E6

View File

@ -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"