From 365badbff1a58f5cd1097acec0abbbef853ccea8 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Mon, 25 Nov 2024 11:19:28 -0500 Subject: [PATCH] Fix test --- .../services/relay/evm/llo/config_poller_test.go | 16 ++++++---------- .../relay/evm/llo/should_retire_cache_test.go | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/core/services/relay/evm/llo/config_poller_test.go b/core/services/relay/evm/llo/config_poller_test.go index e33686b60bd..f9870b22b9c 100644 --- a/core/services/relay/evm/llo/config_poller_test.go +++ b/core/services/relay/evm/llo/config_poller_test.go @@ -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) { @@ -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 } @@ -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) @@ -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"} diff --git a/core/services/relay/evm/llo/should_retire_cache_test.go b/core/services/relay/evm/llo/should_retire_cache_test.go index 2583ecc3c83..25c0c92d017 100644 --- a/core/services/relay/evm/llo/should_retire_cache_test.go +++ b/core/services/relay/evm/llo/should_retire_cache_test.go @@ -13,6 +13,7 @@ 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" @@ -20,7 +21,7 @@ import ( 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)