itests: payments test flake fix

This commit is contained in:
Andras Banki-Horvath committed 2021-08-06 17:37:37 +02:00
1 parent 254d9be6ff
commit 0f400b2b16
1 file changed
+16 -6
+16 -6
View File
@@ -581,6 +581,7 @@ func testBidirectionalAsyncPayments(net *lntest.NetworkHarness, t *harnessTest)
// Next query for Bob's and Alice's channel states, in order to confirm // Next query for Bob's and Alice's channel states, in order to confirm
// that all payment have been successful transmitted. // that all payment have been successful transmitted.
err = wait.NoError(func() error {
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
bobInfo, err := getChanInfo(ctxt, net.Bob) bobInfo, err := getChanInfo(ctxt, net.Bob)
if err != nil { if err != nil {
@@ -588,18 +589,27 @@ func testBidirectionalAsyncPayments(net *lntest.NetworkHarness, t *harnessTest)
} }
if bobInfo.LocalBalance != bobAmt { if bobInfo.LocalBalance != bobAmt {
t.Fatalf("bob's local balance is incorrect, got %v, expected"+ return fmt.Errorf("bob's local balance is incorrect, "+
" %v", bobInfo.LocalBalance, bobAmt) "got %v, expected %v", bobInfo.LocalBalance,
bobAmt)
} }
if bobInfo.RemoteBalance != aliceAmt { if bobInfo.RemoteBalance != aliceAmt {
t.Fatalf("bob's remote balance is incorrect, got %v, "+ return fmt.Errorf("bob's remote balance is incorrect, "+
"expected %v", bobInfo.RemoteBalance, aliceAmt) "got %v, expected %v", bobInfo.RemoteBalance,
aliceAmt)
} }
if len(bobInfo.PendingHtlcs) != 0 { if len(bobInfo.PendingHtlcs) != 0 {
t.Fatalf("bob's pending htlcs is incorrect, got %v, "+ return fmt.Errorf("bob's pending htlcs is incorrect, "+
"expected %v", len(bobInfo.PendingHtlcs), 0) "got %v, expected %v",
len(bobInfo.PendingHtlcs), 0)
} }
return nil
}, defaultTimeout)
require.NoError(t.t, err)
// Finally, immediately close the channel. This function will also // Finally, immediately close the channel. This function will also
// block until the channel is closed and will additionally assert the // block until the channel is closed and will additionally assert the
// relevant channel closing post conditions. // relevant channel closing post conditions.