Skip to content

Commit 05db2c3

Browse files
committed
lntest: add test node name to tmp directory name
In this commit we add the LND node name to the temporary directory's name. This change makes it easier to identify a particular test node's temporary directory. This commit also replaces the depreciated `ioutil.TempDir` function call with `os.MkdirTemp`.
1 parent 1422df2 commit 05db2c3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lntest/node/harness_node.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ type HarnessNode struct {
9797
func NewHarnessNode(t *testing.T, cfg *BaseNodeConfig) (*HarnessNode, error) {
9898
if cfg.BaseDir == "" {
9999
var err error
100-
cfg.BaseDir, err = ioutil.TempDir("", "lndtest-node")
100+
101+
// Create a temporary directory for the node's data and logs.
102+
// Use dash suffix as a separator between base name and random
103+
// suffix.
104+
dirBaseName := fmt.Sprintf("lndtest-node-%s-", cfg.Name)
105+
cfg.BaseDir, err = os.MkdirTemp("", dirBaseName)
101106
if err != nil {
102107
return nil, err
103108
}

0 commit comments

Comments
 (0)