tests: fix several timeout issues
This commit is contained in:
parent
48be9261ef
commit
58c6989e74
@ -2980,7 +2980,7 @@ func testBidirectionalAsyncPayments(net *networkHarness, t *harnessTest) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf(err.Error())
|
t.Fatalf(err.Error())
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second * maxTime):
|
case <-time.After(maxTime):
|
||||||
t.Fatalf("waiting for payments to finish too long "+
|
t.Fatalf("waiting for payments to finish too long "+
|
||||||
"(%v)", maxTime)
|
"(%v)", maxTime)
|
||||||
}
|
}
|
||||||
|
@ -805,6 +805,7 @@ func (n *networkHarness) SetUp() error {
|
|||||||
expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10)
|
expectedBalance := int64(btcutil.SatoshiPerBitcoin * 10)
|
||||||
balReq := &lnrpc.WalletBalanceRequest{}
|
balReq := &lnrpc.WalletBalanceRequest{}
|
||||||
balanceTicker := time.Tick(time.Millisecond * 50)
|
balanceTicker := time.Tick(time.Millisecond * 50)
|
||||||
|
balanceTimeout := time.After(time.Second * 30)
|
||||||
out:
|
out:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -822,7 +823,7 @@ out:
|
|||||||
bobResp.Balance == expectedBalance {
|
bobResp.Balance == expectedBalance {
|
||||||
break out
|
break out
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second * 30):
|
case <-balanceTimeout:
|
||||||
return fmt.Errorf("balances not synced after deadline")
|
return fmt.Errorf("balances not synced after deadline")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1371,9 +1372,11 @@ func (n *networkHarness) SendCoins(ctx context.Context, amt btcutil.Amount,
|
|||||||
// Pause until the nodes current wallet balances reflects the amount
|
// Pause until the nodes current wallet balances reflects the amount
|
||||||
// sent to it above.
|
// sent to it above.
|
||||||
// TODO(roasbeef): factor out into helper func
|
// TODO(roasbeef): factor out into helper func
|
||||||
|
balanceTicker := time.Tick(time.Millisecond * 50)
|
||||||
|
balanceTimeout := time.After(time.Second * 30)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-time.Tick(time.Millisecond * 50):
|
case <-balanceTicker:
|
||||||
currentBal, err := target.WalletBalance(ctx, balReq)
|
currentBal, err := target.WalletBalance(ctx, balReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1382,7 +1385,7 @@ func (n *networkHarness) SendCoins(ctx context.Context, amt btcutil.Amount,
|
|||||||
if currentBal.Balance == initialBalance.Balance+int64(amt) {
|
if currentBal.Balance == initialBalance.Balance+int64(amt) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case <-time.After(time.Second * 30):
|
case <-balanceTimeout:
|
||||||
return fmt.Errorf("balances not synced after deadline")
|
return fmt.Errorf("balances not synced after deadline")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user