lntest/itest: 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:07:17 +08:00
parent 0edc16aa01
commit ca5c695526
No known key found for this signature in database
GPG Key ID: DAEBBD2E34C111E6
2 changed files with 2 additions and 11 deletions

View File

@ -569,11 +569,7 @@ func testChannelBackupUpdates(net *lntest.NetworkHarness, t *harnessTest) {
// First, we'll make a temp directory that we'll use to store our
// backup file, so we can check in on it during the test easily.
backupDir, err := ioutil.TempDir("", "")
if err != nil {
t.Fatalf("unable to create backup dir: %v", err)
}
defer os.RemoveAll(backupDir)
backupDir := t.t.TempDir()
// First, we'll create a new node, Carol. We'll also create a temporary
// file that Carol will use to store her channel backups.

View File

@ -5,7 +5,6 @@ package itest
import (
"context"
"io/ioutil"
"testing"
"time"
@ -68,12 +67,8 @@ func testEtcdFailoverCase(net *lntest.NetworkHarness, ht *harnessTest,
ctxb := context.Background()
tmpDir, err := ioutil.TempDir("", "etcd")
if err != nil {
ht.Fatalf("Failed to create temp dir: %v", err)
}
etcdCfg, cleanup, err := kvdb.StartEtcdTestBackend(
tmpDir, uint16(lntest.NextAvailablePort()),
ht.t.TempDir(), uint16(lntest.NextAvailablePort()),
uint16(lntest.NextAvailablePort()), "",
)
if err != nil {