Commit 4872837d authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-e2e: Retry the receipts fetcher test (#12794)

This is one of our flakiest tests since it's very dependent on the test runner's CPU usage.
parent 4c25686a
......@@ -9,6 +9,8 @@ import (
"testing"
"time"
"github.com/ethereum-optimism/optimism/op-service/retry"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
......@@ -104,6 +106,13 @@ func TestBasicRPCReceiptsFetcher_Concurrency(t *testing.T) {
for _, rec := range receipts {
recMap[rec.TxHash] = rec
}
boff := &retry.ExponentialStrategy{
Min: 0,
Max: time.Second,
MaxJitter: 100 * time.Millisecond,
}
err := retry.Do0(context.Background(), 10, boff, func() error {
mrpc := new(mockRPC)
rp := NewBasicRPCReceiptsFetcher(mrpc, batchSize)
......@@ -128,8 +137,17 @@ func TestBasicRPCReceiptsFetcher_Concurrency(t *testing.T) {
mrpc.AssertExpectations(t)
finalNumCalls := int(numCalls.Load())
require.NotZero(finalNumCalls, "BatchCallContext should have been called.")
require.Less(finalNumCalls, numFetchers*numBatchCalls, "Some IterativeBatchCalls should have been shared.")
if finalNumCalls == 0 {
return errors.New("batchCallContext should have been called")
}
if finalNumCalls >= numFetchers*numBatchCalls {
return errors.New("some IterativeBatchCalls should have been shared")
}
return nil
})
require.NoError(err)
}
func runConcurrentFetchingTest(t *testing.T, rp ReceiptsProvider, numFetchers int, receipts types.Receipts, block *RPCBlock) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment