mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-15 02:55:37 +02:00
aliasmgr: use T.TempDir
to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
package aliasmgr
|
package aliasmgr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -18,11 +16,7 @@ func TestAliasStorePeerAlias(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
// Create the backend database and use this to create the aliasStore.
|
// Create the backend database and use this to create the aliasStore.
|
||||||
dbDir, err := ioutil.TempDir("", "aliasStore")
|
dbPath := filepath.Join(t.TempDir(), "testdb")
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(dbDir)
|
|
||||||
|
|
||||||
dbPath := filepath.Join(dbDir, "testdb")
|
|
||||||
db, err := kvdb.Create(
|
db, err := kvdb.Create(
|
||||||
kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
|
kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
|
||||||
)
|
)
|
||||||
@@ -51,11 +45,7 @@ func TestAliasStoreRequest(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
// Create the backend database and use this to create the aliasStore.
|
// Create the backend database and use this to create the aliasStore.
|
||||||
dbDir, err := ioutil.TempDir("", "aliasStore")
|
dbPath := filepath.Join(t.TempDir(), "testdb")
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(dbDir)
|
|
||||||
|
|
||||||
dbPath := filepath.Join(dbDir, "testdb")
|
|
||||||
db, err := kvdb.Create(
|
db, err := kvdb.Create(
|
||||||
kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
|
kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user