Merge pull request #1877 from halseth/garbage-collect-link-nodes
[integration tests] Fix flake in persistent connection pruning test
This commit is contained in:
commit
2c48ec8dde
33
lnd_test.go
33
lnd_test.go
@ -5663,6 +5663,12 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
if err != nil {
|
||||
t.Fatalf("alice did not reconnect to carol")
|
||||
}
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
return isConnected(dave.PubKeyStr)
|
||||
}, 15*time.Second)
|
||||
if err != nil {
|
||||
t.Fatalf("alice did not reconnect to dave")
|
||||
}
|
||||
|
||||
// testReconnection is a helper closure that restarts the nodes at both
|
||||
// ends of a channel to ensure they do not reconnect after restarting.
|
||||
@ -5670,13 +5676,24 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// reestablished her connection with Dave, as they still have an open
|
||||
// channel together.
|
||||
testReconnection := func(node *lntest.HarnessNode) {
|
||||
// Restart both nodes, to trigger the pruning logic.
|
||||
if err := net.RestartNode(node, nil); err != nil {
|
||||
t.Fatalf("unable to restart %v's node: %v",
|
||||
node.Name(), err)
|
||||
}
|
||||
|
||||
if err := net.RestartNode(net.Alice, nil); err != nil {
|
||||
t.Fatalf("unable to restart alice's node: %v", err)
|
||||
}
|
||||
|
||||
// Now restart both nodes and make sure they don't reconnect.
|
||||
if err := net.RestartNode(node, nil); err != nil {
|
||||
t.Fatalf("unable to restart %v's node: %v", node.Name(),
|
||||
err)
|
||||
}
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
err = lntest.WaitInvariant(func() bool {
|
||||
return !isConnected(node.PubKeyStr)
|
||||
}, 20*time.Second)
|
||||
}, 5*time.Second)
|
||||
if err != nil {
|
||||
t.Fatalf("alice reconnected to %v", node.Name())
|
||||
}
|
||||
@ -5685,11 +5702,15 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("unable to restart alice's node: %v", err)
|
||||
}
|
||||
err = lntest.WaitPredicate(func() bool {
|
||||
if !isConnected(dave.PubKeyStr) {
|
||||
return false
|
||||
}
|
||||
return !isConnected(node.PubKeyStr)
|
||||
return isConnected(dave.PubKeyStr)
|
||||
}, 20*time.Second)
|
||||
if err != nil {
|
||||
t.Fatalf("alice didn't reconnect to Dave")
|
||||
}
|
||||
|
||||
err = lntest.WaitInvariant(func() bool {
|
||||
return !isConnected(node.PubKeyStr)
|
||||
}, 5*time.Second)
|
||||
if err != nil {
|
||||
t.Fatalf("alice reconnected to %v", node.Name())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user