lnd_test: make sure we stay disconnected using WaitInvariant in testGarbageCollectLinkNodes
This commit is contained in:
parent
1941353fb2
commit
a926665358
22
lnd_test.go
22
lnd_test.go
@ -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.
|
||||||
@ -5674,9 +5680,9 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
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 +5691,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())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user