Skip to content

Commit c86826a

Browse files
committed
lntest: fix error check in shutdownAllNodes
Previously the test failed only if the last node failed to shutdown. The code was updated to fail if any node failed to shutdown.
1 parent 630108b commit c86826a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lntest/harness.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ func (h *HarnessTest) shutdownNodesNoAssert() {
435435

436436
// shutdownAllNodes will shutdown all running nodes.
437437
func (h *HarnessTest) shutdownAllNodes() {
438-
var err error
438+
var lastErr error
439439
for _, node := range h.manager.activeNodes {
440-
err = h.manager.shutdownNode(node)
440+
err := h.manager.shutdownNode(node)
441441
if err == nil {
442442
continue
443443
}
@@ -446,9 +446,11 @@ func (h *HarnessTest) shutdownAllNodes() {
446446
// is needed so other nodes can continue their shutdown
447447
// processes.
448448
h.Logf("unable to shutdown %s, got err: %v", node.Name(), err)
449+
450+
lastErr = err
449451
}
450452

451-
require.NoError(h, err, "failed to shutdown all nodes")
453+
require.NoError(h, lastErr, "failed to shutdown all nodes")
452454
}
453455

454456
// cleanupStandbyNode is a function should be called with defer whenever a

0 commit comments

Comments
 (0)