Merge pull request #1877 from halseth/garbage-collect-link-nodes
[integration tests] Fix flake in persistent connection pruning test
This commit is contained in:
1 file changed
+27
-6
+27
-6
@@ -5663,6 +5663,12 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("alice did not reconnect to carol")
|
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
|
// testReconnection is a helper closure that restarts the nodes at both
|
||||||
// ends of a channel to ensure they do not reconnect after restarting.
|
// 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
|
// reestablished her connection with Dave, as they still have an open
|
||||||
// channel together.
|
// channel together.
|
||||||
testReconnection := func(node *lntest.HarnessNode) {
|
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 {
|
if err := net.RestartNode(node, nil); err != nil {
|
||||||
t.Fatalf("unable to restart %v's node: %v", node.Name(),
|
t.Fatalf("unable to restart %v's node: %v", node.Name(),
|
||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
err = lntest.WaitPredicate(func() bool {
|
err = lntest.WaitInvariant(func() bool {
|
||||||
return !isConnected(node.PubKeyStr)
|
return !isConnected(node.PubKeyStr)
|
||||||
}, 20*time.Second)
|
}, 5*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("alice reconnected to %v", node.Name())
|
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)
|
t.Fatalf("unable to restart alice's node: %v", err)
|
||||||
}
|
}
|
||||||
err = lntest.WaitPredicate(func() bool {
|
err = lntest.WaitPredicate(func() bool {
|
||||||
if !isConnected(dave.PubKeyStr) {
|
return isConnected(dave.PubKeyStr)
|
||||||
return false
|
|
||||||
}
|
|
||||||
return !isConnected(node.PubKeyStr)
|
|
||||||
}, 20*time.Second)
|
}, 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 {
|
if err != nil {
|
||||||
t.Fatalf("alice reconnected to %v", node.Name())
|
t.Fatalf("alice reconnected to %v", node.Name())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user