Merge pull request #5429 from Roasbeef/itest-recovery-shutdown
lntest: retry node shutdown attempts to recovery tests
This commit is contained in:
commit
e62f0e1f3a
@ -594,7 +594,13 @@ func assertNumConnections(t *harnessTest, alice, bob *lntest.HarnessNode,
|
|||||||
// occur.
|
// occur.
|
||||||
func shutdownAndAssert(net *lntest.NetworkHarness, t *harnessTest,
|
func shutdownAndAssert(net *lntest.NetworkHarness, t *harnessTest,
|
||||||
node *lntest.HarnessNode) {
|
node *lntest.HarnessNode) {
|
||||||
if err := net.ShutdownNode(node); err != nil {
|
|
||||||
|
// The process may not be in a state to always shutdown immediately, so
|
||||||
|
// we'll retry up to a hard limit to ensure we eventually shutdown.
|
||||||
|
err := wait.NoError(func() error {
|
||||||
|
return net.ShutdownNode(node)
|
||||||
|
}, defaultTimeout)
|
||||||
|
if err != nil {
|
||||||
t.Fatalf("unable to shutdown %v: %v", node.Name(), err)
|
t.Fatalf("unable to shutdown %v: %v", node.Name(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1115,7 +1115,10 @@ func (hn *HarnessNode) stop() error {
|
|||||||
// closed before a response is returned.
|
// closed before a response is returned.
|
||||||
req := lnrpc.StopRequest{}
|
req := lnrpc.StopRequest{}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
hn.LightningClient.StopDaemon(ctx, &req)
|
_, err := hn.LightningClient.StopDaemon(ctx, &req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for lnd process and other goroutines to exit.
|
// Wait for lnd process and other goroutines to exit.
|
||||||
|
Loading…
Reference in New Issue
Block a user