Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Nov 25, 2024
1 parent 4321e0e commit 365badb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
16 changes: 6 additions & 10 deletions core/services/relay/evm/llo/config_poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var _ LogPoller = (*mockLogPoller)(nil)
type mockLogPoller struct {
logs []logpoller.Log
latestBlock int64

exprs []query.Expression
limitAndSort query.LimitAndSort
}

func (m *mockLogPoller) LatestBlock(ctx context.Context) (logpoller.LogPollerBlock, error) {
Expand All @@ -37,6 +40,8 @@ func (m *mockLogPoller) Replay(ctx context.Context, fromBlock int64) error {
return nil
}
func (m *mockLogPoller) FilteredLogs(ctx context.Context, filter []query.Expression, limitAndSort query.LimitAndSort, queryName string) ([]logpoller.Log, error) {
m.exprs = filter
m.limitAndSort = limitAndSort
return m.logs, nil
}

Expand All @@ -58,7 +63,7 @@ func (m *mockConfigCache) StoreConfig(ctx context.Context, cd ocrtypes.ConfigDig
func Test_ConfigPoller(t *testing.T) {
ctx := testutils.Context(t)
lggr := logger.Test(t)
lp := &mockLogPoller{make([]logpoller.Log, 0), 0}
lp := &mockLogPoller{make([]logpoller.Log, 0), 0, nil, query.LimitAndSort{}}
addr := common.Address{1}
donID := uint32(1)
donIDHash := DonIDToBytes32(donID)
Expand Down Expand Up @@ -315,15 +320,6 @@ func Test_ConfigPoller(t *testing.T) {
})
})
t.Run("LatestConfig", func(t *testing.T) {
t.Run("changedInBlock in future, returns nothing", func(t *testing.T) {
cfg, err := cpBlue.LatestConfig(ctx, 200)
require.NoError(t, err)
assert.Zero(t, cfg)

cfg, err = cpGreen.LatestConfig(ctx, 200)
require.NoError(t, err)
assert.Zero(t, cfg)
})
t.Run("changedInBlock corresponds to a block in which a log was emitted, returns the config", func(t *testing.T) {
expectedSigners := []ocr2types.OnchainPublicKey{ocr2types.OnchainPublicKey{0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, ocr2types.OnchainPublicKey{0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
expectedTransmitters := []ocr2types.Account{"0100000000000000000000000000000000000000000000000000000000000000", "0200000000000000000000000000000000000000000000000000000000000000"}
Expand Down
3 changes: 2 additions & 1 deletion core/services/relay/evm/llo/should_retire_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink-common/pkg/types/query"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
)

func Test_ShouldRetireCache(t *testing.T) {
lggr, observedLogs := logger.TestObserved(t, zapcore.DebugLevel)
lp := &mockLogPoller{make([]logpoller.Log, 0), 0}
lp := &mockLogPoller{make([]logpoller.Log, 0), 0, nil, query.LimitAndSort{}}
addr := common.Address{1}
donID := uint32(1)
donIDHash := DonIDToBytes32(donID)
Expand Down

0 comments on commit 365badb

Please sign in to comment.