mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 22:10:27 +02:00
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`.
This commit is contained in:
@ -97,7 +97,12 @@ type HarnessNode struct {
|
|||||||
func NewHarnessNode(t *testing.T, cfg *BaseNodeConfig) (*HarnessNode, error) {
|
func NewHarnessNode(t *testing.T, cfg *BaseNodeConfig) (*HarnessNode, error) {
|
||||||
if cfg.BaseDir == "" {
|
if cfg.BaseDir == "" {
|
||||||
var err error
|
var err error
|
||||||
cfg.BaseDir, err = ioutil.TempDir("", "lndtest-node")
|
|
||||||
|
// Create a temporary directory for the node's data and logs.
|
||||||
|
// Use dash suffix as a separator between base name and random
|
||||||
|
// suffix.
|
||||||
|
dirBaseName := fmt.Sprintf("lndtest-node-%s-", cfg.Name)
|
||||||
|
cfg.BaseDir, err = os.MkdirTemp("", dirBaseName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user