lntest: replace hard coded timeouts

This commit replaces most of the hard coded 10, 15, 20 and 30 second
timeouts with the default timeout. This should allow darwin users to
successfully run the parallel itests locally as well.
This commit is contained in:
Oliver Gugger committed 2020-12-08 21:37:12 +01:00
1 parent dfb131f82f
commit cdcbc0376d
4 files changed
+74 -74

No files matched your search

+11 -11
View File
@@ -225,7 +225,7 @@ func (n *NetworkHarness) SetUp(testCase string, lndArgs []string) error {
balReq := &lnrpc.WalletBalanceRequest{}
balanceTicker := time.NewTicker(time.Millisecond * 200)
defer balanceTicker.Stop()
balanceTimeout := time.After(time.Second * 30)
balanceTimeout := time.After(DefaultTimeout)
out:
for {
select {
@@ -290,7 +290,7 @@ func (n *NetworkHarness) NewNodeWithSeed(name string, extraArgs []string,
return nil, nil, nil, err
}
timeout := time.Duration(time.Second * 15)
timeout := time.Duration(DefaultTimeout)
ctxb := context.Background()
// Create a request to generate a new aezeed. The new seed will have the
@@ -424,7 +424,7 @@ func (n *NetworkHarness) RegisterNode(node *HarnessNode) {
func (n *NetworkHarness) connect(ctx context.Context,
req *lnrpc.ConnectPeerRequest, a *HarnessNode) error {
syncTimeout := time.After(15 * time.Second)
syncTimeout := time.After(DefaultTimeout)
tryconnect:
if _, err := a.ConnectPeer(ctx, req); err != nil {
// If the chain backend is still syncing, retry.
@@ -457,7 +457,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode)
errConnectionRequested := errors.New("connection request in progress")
tryConnect := func(a, b *HarnessNode) error {
ctxt, _ := context.WithTimeout(ctx, 15*time.Second)
ctxt, _ := context.WithTimeout(ctx, DefaultTimeout)
bInfo, err := b.GetInfo(ctxt, &lnrpc.GetInfoRequest{})
if err != nil {
return err
@@ -472,7 +472,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode)
var predErr error
err = wait.Predicate(func() bool {
ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
ctx, cancel := context.WithTimeout(ctx, DefaultTimeout)
defer cancel()
err := n.connect(ctx, req, a)
@@ -530,7 +530,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode)
// If node B is seen in the ListPeers response from node A,
// then we can exit early as the connection has been fully
// established.
ctxt, _ := context.WithTimeout(ctx, 15*time.Second)
ctxt, _ := context.WithTimeout(ctx, DefaultTimeout)
resp, err := b.ListPeers(ctxt, &lnrpc.ListPeersRequest{})
if err != nil {
return false
@@ -547,7 +547,7 @@ func (n *NetworkHarness) EnsureConnected(ctx context.Context, a, b *HarnessNode)
err := wait.Predicate(func() bool {
return findSelfInPeerList(a, b) && findSelfInPeerList(b, a)
}, time.Second*15)
}, DefaultTimeout)
if err != nil {
return fmt.Errorf("peers not connected within 15 seconds")
}
@@ -594,7 +594,7 @@ func (n *NetworkHarness) ConnectNodes(ctx context.Context, a, b *HarnessNode) er
}
return false
}, time.Second*15)
}, DefaultTimeout)
if err != nil {
return fmt.Errorf("peers not connected within 15 seconds")
}
@@ -1038,7 +1038,7 @@ func (n *NetworkHarness) CloseChannel(ctx context.Context,
// We'll wait for *both* nodes to read the channel as active if we're
// performing a cooperative channel closure.
if !force {
timeout := time.Second * 15
timeout := DefaultTimeout
listReq := &lnrpc.ListChannelsRequest{}
// We define two helper functions, one two locate a particular
@@ -1223,7 +1223,7 @@ func (n *NetworkHarness) AssertChannelExists(ctx context.Context,
}
return fmt.Errorf("channel %s not found", chanPoint)
}, 15*time.Second)
}, DefaultTimeout)
}
// DumpLogs reads the current logs generated by the passed node, and returns
@@ -1355,7 +1355,7 @@ func (n *NetworkHarness) sendCoins(ctx context.Context, amt btcutil.Amount,
}
return nil
}, 15*time.Second)
}, DefaultTimeout)
if err != nil {
return fmt.Errorf("unconfirmed utxo was not found in "+
"ListUnspent: %v", err)