mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
contractcourt: use T.TempDir
to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -3,8 +3,6 @@ package contractcourt
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"sort"
|
||||
@@ -406,11 +404,7 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
|
||||
|
||||
var cleanUp func()
|
||||
if log == nil {
|
||||
dbDir, err := ioutil.TempDir("", "chanArb")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dbPath := filepath.Join(dbDir, "testdb")
|
||||
dbPath := filepath.Join(t.TempDir(), "testdb")
|
||||
db, err := kvdb.Create(
|
||||
kvdb.BoltBackendName, dbPath, true,
|
||||
kvdb.DefaultDBTimeout,
|
||||
@@ -427,7 +421,6 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
|
||||
}
|
||||
cleanUp = func() {
|
||||
db.Close()
|
||||
os.RemoveAll(dbDir)
|
||||
}
|
||||
|
||||
log = &testArbLog{
|
||||
|
Reference in New Issue
Block a user