integration tests: use wait predicate to get Bob balance

This commit is contained in:
Johan T. Halseth 2018-01-24 11:12:52 +01:00
parent a55c74f80c
commit 764323eb69
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -3173,14 +3173,23 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
// Next query for Bob's channel state, as we sent 3 payments of 10k // Next query for Bob's channel state, as we sent 3 payments of 10k
// satoshis each, Bob should now see his balance as being 30k satoshis. // satoshis each, Bob should now see his balance as being 30k satoshis.
time.Sleep(time.Millisecond * 200) var bobChan *lnrpc.ActiveChannel
bobChan, err := getBobChanInfo() var predErr error
err = lntest.WaitPredicate(func() bool {
bobChan, err = getBobChanInfo()
if err != nil {
t.Fatalf("unable to get bob's channel info: %v", err)
}
if bobChan.LocalBalance != 30000 {
predErr = fmt.Errorf("bob's balance is incorrect, "+
"got %v, expected %v", bobChan.LocalBalance,
30000)
return false
}
return true
}, time.Second*15)
if err != nil { if err != nil {
t.Fatalf("unable to get bob's channel info: %v", err) t.Fatalf("%v", predErr)
}
if bobChan.LocalBalance != 30000 {
t.Fatalf("bob's balance is incorrect, got %v, expected %v",
bobChan.LocalBalance, 30000)
} }
// Grab Bob's current commitment height (update number), we'll later // Grab Bob's current commitment height (update number), we'll later