Merge pull request #5607 from bhandras/payments_test_flake_fix

itests: payments test flake fix
This commit is contained in:
András Bánki-Horváth
2021-08-10 09:15:56 +02:00
committed by GitHub
2 changed files with 29 additions and 17 deletions

View File

@@ -95,6 +95,8 @@ you.
* [Fixed timeout flakes in async payment benchmark tests](https://github.com/lightningnetwork/lnd/pull/5579). * [Fixed timeout flakes in async payment benchmark tests](https://github.com/lightningnetwork/lnd/pull/5579).
* [Flake fix in async bidirectional payment test](https://github.com/lightningnetwork/lnd/pull/5607).
* [Fixed a missing import and git tag in the healthcheck package](https://github.com/lightningnetwork/lnd/pull/5582). * [Fixed a missing import and git tag in the healthcheck package](https://github.com/lightningnetwork/lnd/pull/5582).
* [Fixed a data race in payment unit test](https://github.com/lightningnetwork/lnd/pull/5573). * [Fixed a data race in payment unit test](https://github.com/lightningnetwork/lnd/pull/5573).

View File

@@ -581,24 +581,34 @@ 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.
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) err = wait.NoError(func() error {
bobInfo, err := getChanInfo(ctxt, net.Bob) ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
if err != nil { bobInfo, err := getChanInfo(ctxt, net.Bob)
t.Fatalf("unable to get bob's channel info: %v", err) if err != nil {
} t.Fatalf("unable to get bob's channel info: %v", err)
}
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 { }
t.Fatalf("bob's remote balance is incorrect, got %v, "+
"expected %v", bobInfo.RemoteBalance, aliceAmt) if bobInfo.RemoteBalance != aliceAmt {
} return fmt.Errorf("bob's remote balance is incorrect, "+
if len(bobInfo.PendingHtlcs) != 0 { "got %v, expected %v", bobInfo.RemoteBalance,
t.Fatalf("bob's pending htlcs is incorrect, got %v, "+ aliceAmt)
"expected %v", len(bobInfo.PendingHtlcs), 0) }
}
if len(bobInfo.PendingHtlcs) != 0 {
return fmt.Errorf("bob's pending htlcs is incorrect, "+
"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