Skip to content

Commit

Permalink
Fix flakey ccipreader_test as per CCIP pr 1337 (#14189)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gopalswami authored Aug 21, 2024
1 parent ee57b4f commit 5b9d92d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ccipreader
import (
"context"
"math/big"
"sort"
"testing"
"time"

Expand Down Expand Up @@ -110,7 +111,7 @@ func TestCCIPReader_CommitReportsGTETimestamp(t *testing.T) {
)
require.NoError(t, err)
return len(reports) == numReports-1
}, testutils.WaitTimeout(t), 50*time.Millisecond)
}, 10*time.Second, 50*time.Millisecond)

assert.Len(t, reports[0].Report.MerkleRoots, 1)
assert.Equal(t, chainS1, reports[0].Report.MerkleRoots[0].ChainSel)
Expand Down Expand Up @@ -250,6 +251,10 @@ func TestCCIPReader_MsgsBetweenSeqNums(t *testing.T) {

s.sb.Commit()

// Need to replay as sometimes the logs are not picked up by the log poller (?)
// Maybe another situation where chain reader doesn't register filters as expected.
require.NoError(t, s.lp.Replay(ctx, 1))

var msgs []cciptypes.Message
require.Eventually(t, func() bool {
msgs, err = s.reader.MsgsBetweenSeqNums(
Expand All @@ -262,6 +267,10 @@ func TestCCIPReader_MsgsBetweenSeqNums(t *testing.T) {
}, 10*time.Second, 100*time.Millisecond)

require.Len(t, msgs, 2)
// sort to ensure ascending order of sequence numbers.
sort.Slice(msgs, func(i, j int) bool {
return msgs[i].Header.SequenceNumber < msgs[j].Header.SequenceNumber
})
require.Equal(t, cciptypes.SeqNum(10), msgs[0].Header.SequenceNumber)
require.Equal(t, cciptypes.SeqNum(15), msgs[1].Header.SequenceNumber)
for _, msg := range msgs {
Expand Down

0 comments on commit 5b9d92d

Please sign in to comment.