From b8783263963f7b42f5b33661394c7dbae5073a5c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 14 Apr 2021 19:53:54 +0200 Subject: [PATCH] e2e: relax timeouts (#6356) * remove duplicate light error * quieten handling of txs that already exist in the mempool * notch back e2e timeouts --- light/client.go | 4 ++-- light/detector.go | 2 +- light/errors.go | 8 -------- mempool/reactor.go | 4 +++- test/e2e/runner/perturb.go | 2 +- test/e2e/runner/start.go | 2 +- test/e2e/tests/app_test.go | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/light/client.go b/light/client.go index 668fd9b80..ef7fc1ba3 100644 --- a/light/client.go +++ b/light/client.go @@ -240,7 +240,7 @@ func NewClientFromTrustedStore( // Validate the number of witnesses. if len(c.witnesses) < 1 { - return nil, errNoWitnesses{} + return nil, ErrNoWitnesses } // Verify witnesses are all on the same chain. @@ -1127,7 +1127,7 @@ func (c *Client) compareFirstHeaderWithWitnesses(ctx context.Context, h *types.S defer c.providerMutex.Unlock() if len(c.witnesses) < 1 { - return errNoWitnesses{} + return ErrNoWitnesses } errc := make(chan error, len(c.witnesses)) diff --git a/light/detector.go b/light/detector.go index 2dbf15134..a755cf68d 100644 --- a/light/detector.go +++ b/light/detector.go @@ -41,7 +41,7 @@ func (c *Client) detectDivergence(ctx context.Context, primaryTrace []*types.Lig defer c.providerMutex.Unlock() if len(c.witnesses) == 0 { - return errNoWitnesses{} + return ErrNoWitnesses } // launch one goroutine per witness to retrieve the light block of the target height diff --git a/light/errors.go b/light/errors.go index aba9e63e1..73ed232b3 100644 --- a/light/errors.go +++ b/light/errors.go @@ -89,14 +89,6 @@ func (e errConflictingHeaders) Error() string { e.Block.Hash(), e.WitnessIndex) } -// errNoWitnesses means that there are not enough witnesses connected to -// continue running the light client. -type errNoWitnesses struct{} - -func (e errNoWitnesses) Error() string { - return "no witnesses connected. please reset light client" -} - // errBadWitness is returned when the witness either does not respond or // responds with an invalid header. type errBadWitness struct { diff --git a/mempool/reactor.go b/mempool/reactor.go index 0babb4b6c..99711a373 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -181,7 +181,9 @@ func (memR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { } for _, tx := range msg.Txs { err = memR.mempool.CheckTx(tx, nil, txInfo) - if err != nil { + if err == ErrTxInCache { + memR.Logger.Debug("Tx already exists in cache", "tx", txID(tx)) + } else if err != nil { memR.Logger.Info("Could not check tx", "tx", txID(tx), "err", err) } } diff --git a/test/e2e/runner/perturb.go b/test/e2e/runner/perturb.go index 5194b70a6..46019ef23 100644 --- a/test/e2e/runner/perturb.go +++ b/test/e2e/runner/perturb.go @@ -66,7 +66,7 @@ func PerturbNode(node *e2e.Node, perturbation e2e.Perturbation) (*rpctypes.Resul return nil, fmt.Errorf("unexpected perturbation %q", perturbation) } - status, err := waitForNode(node, 0, 10*time.Second) + status, err := waitForNode(node, 0, 20*time.Second) if err != nil { return nil, err } diff --git a/test/e2e/runner/start.go b/test/e2e/runner/start.go index 5a1768b32..4fb985b16 100644 --- a/test/e2e/runner/start.go +++ b/test/e2e/runner/start.go @@ -75,7 +75,7 @@ func Start(testnet *e2e.Testnet) error { if err := execCompose(testnet.Dir, "up", "-d", node.Name); err != nil { return err } - status, err := waitForNode(node, node.StartAt, 1*time.Minute) + status, err := waitForNode(node, node.StartAt, 3*time.Minute) if err != nil { return err } diff --git a/test/e2e/tests/app_test.go b/test/e2e/tests/app_test.go index d53cf09fb..a86a9c9ab 100644 --- a/test/e2e/tests/app_test.go +++ b/test/e2e/tests/app_test.go @@ -86,7 +86,7 @@ func TestApp_Tx(t *testing.T) { require.NoError(t, err) hash := tx.Hash() - waitTime := 20 * time.Second + waitTime := 30 * time.Second require.Eventuallyf(t, func() bool { txResp, err := client.Tx(ctx, hash, false) return err == nil && bytes.Equal(txResp.Tx, tx)