lntest: Add ShutdownNode method to harness.
This is preferable to calling Shutdown on the node directly so that the harness manages the entire lifecycle of an lnd process.
This commit is contained in:
1 parent
77d5f21b54
commit
19ed1fb8db
3 files changed
+25
-14
No files matched your search
+12
-1
@@ -224,7 +224,7 @@ out:
|
||||
// TearDownAll tears down all active nodes within the test lightning network.
|
||||
func (n *NetworkHarness) TearDownAll() error {
|
||||
for _, node := range n.activeNodes {
|
||||
if err := node.Shutdown(); err != nil {
|
||||
if err := n.ShutdownNode(node); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -341,6 +341,17 @@ func (n *NetworkHarness) RestartNode(node *HarnessNode, callback func() error) e
|
||||
return node.restart(n.lndErrorChan, callback)
|
||||
}
|
||||
|
||||
// ShutdownNode stops an active lnd process and returns when the process has
|
||||
// exited and any temporary directories have been cleaned up.
|
||||
func (n *NetworkHarness) ShutdownNode(node *HarnessNode) error {
|
||||
if err := node.shutdown(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(n.activeNodes, node.NodeID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO(roasbeef): add a WithChannel higher-order function?
|
||||
// * python-like context manager w.r.t using a channel within a test
|
||||
// * possibly adds more funds to the target wallet if the funds are not
|
||||
|
||||
Reference in new issue
Block a user