funding: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
1 file changed
+2
-12
+2
-12
@@ -8,9 +8,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -644,19 +642,13 @@ type cfgOption func(*Config)
|
|||||||
func setupFundingManagers(t *testing.T,
|
func setupFundingManagers(t *testing.T,
|
||||||
options ...cfgOption) (*testNode, *testNode) {
|
options ...cfgOption) (*testNode, *testNode) {
|
||||||
|
|
||||||
aliceTestDir, err := ioutil.TempDir("", "alicelnwallet")
|
|
||||||
require.NoError(t, err, "unable to create temp directory")
|
|
||||||
|
|
||||||
alice, err := createTestFundingManager(
|
alice, err := createTestFundingManager(
|
||||||
t, alicePrivKey, aliceAddr, aliceTestDir, options...,
|
t, alicePrivKey, aliceAddr, t.TempDir(), options...,
|
||||||
)
|
)
|
||||||
require.NoError(t, err, "failed creating fundingManager")
|
require.NoError(t, err, "failed creating fundingManager")
|
||||||
|
|
||||||
bobTestDir, err := ioutil.TempDir("", "boblnwallet")
|
|
||||||
require.NoError(t, err, "unable to create temp directory")
|
|
||||||
|
|
||||||
bob, err := createTestFundingManager(
|
bob, err := createTestFundingManager(
|
||||||
t, bobPrivKey, bobAddr, bobTestDir, options...,
|
t, bobPrivKey, bobAddr, t.TempDir(), options...,
|
||||||
)
|
)
|
||||||
require.NoError(t, err, "failed creating fundingManager")
|
require.NoError(t, err, "failed creating fundingManager")
|
||||||
|
|
||||||
@@ -699,8 +691,6 @@ func tearDownFundingManagers(t *testing.T, a, b *testNode) {
|
|||||||
if err := b.fundingMgr.Stop(); err != nil {
|
if err := b.fundingMgr.Stop(); err != nil {
|
||||||
t.Fatalf("failed stop funding manager: %v", err)
|
t.Fatalf("failed stop funding manager: %v", err)
|
||||||
}
|
}
|
||||||
os.RemoveAll(a.testDir)
|
|
||||||
os.RemoveAll(b.testDir)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// openChannel takes the funding process to the point where the funding
|
// openChannel takes the funding process to the point where the funding
|
||||||
|
|||||||
Reference in new issue
Block a user