lntest: properly handle shutdown error

This commit removes the panic used in checking the shutdown log.
Instead, the error is returned and asserted in `shutdownAllNodes` so
it's easier to check which node failed in which test. We also catch all
the errors returned from `StopDaemon` call to properly access the
shutdown behavior.
This commit is contained in:
yyforyongyu
2024-12-05 10:25:23 +08:00
parent 73574d919d
commit 31b66962d8
3 changed files with 58 additions and 51 deletions

View File

@@ -112,11 +112,14 @@ func (nm *nodeManager) registerNode(node *node.HarnessNode) {
// ShutdownNode stops an active lnd process and returns when the process has
// exited and any temporary directories have been cleaned up.
func (nm *nodeManager) shutdownNode(node *node.HarnessNode) error {
// Remove the node from the active nodes map even if the shutdown
// fails as the shutdown cannot be retried in that case.
delete(nm.activeNodes, node.Cfg.NodeID)
if err := node.Shutdown(); err != nil {
return err
}
delete(nm.activeNodes, node.Cfg.NodeID)
return nil
}