From 5c9d0ee81f60b3be943edb36a8d63bb0266a012f Mon Sep 17 00:00:00 2001 From: Mateusz Sekara Date: Fri, 2 Aug 2024 13:18:34 +0200 Subject: [PATCH] Removing unused function from feeds --- core/services/feeds/mocks/service.go | 33 ------------------- core/services/feeds/service.go | 14 +------- .../ccip/testhelpers/integration/chainlink.go | 1 - .../testhelpers_1_4_0/chainlink.go | 1 - 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/core/services/feeds/mocks/service.go b/core/services/feeds/mocks/service.go index d37c327850..a660420759 100644 --- a/core/services/feeds/mocks/service.go +++ b/core/services/feeds/mocks/service.go @@ -1403,39 +1403,6 @@ func (_c *Service_SyncNodeInfo_Call) RunAndReturn(run func(context.Context, int6 return _c } -// Unsafe_SetConnectionsManager provides a mock function with given fields: _a0 -func (_m *Service) Unsafe_SetConnectionsManager(_a0 feeds.ConnectionsManager) { - _m.Called(_a0) -} - -// Service_Unsafe_SetConnectionsManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unsafe_SetConnectionsManager' -type Service_Unsafe_SetConnectionsManager_Call struct { - *mock.Call -} - -// Unsafe_SetConnectionsManager is a helper method to define mock.On call -// - _a0 feeds.ConnectionsManager -func (_e *Service_Expecter) Unsafe_SetConnectionsManager(_a0 interface{}) *Service_Unsafe_SetConnectionsManager_Call { - return &Service_Unsafe_SetConnectionsManager_Call{Call: _e.mock.On("Unsafe_SetConnectionsManager", _a0)} -} - -func (_c *Service_Unsafe_SetConnectionsManager_Call) Run(run func(_a0 feeds.ConnectionsManager)) *Service_Unsafe_SetConnectionsManager_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(feeds.ConnectionsManager)) - }) - return _c -} - -func (_c *Service_Unsafe_SetConnectionsManager_Call) Return() *Service_Unsafe_SetConnectionsManager_Call { - _c.Call.Return() - return _c -} - -func (_c *Service_Unsafe_SetConnectionsManager_Call) RunAndReturn(run func(feeds.ConnectionsManager)) *Service_Unsafe_SetConnectionsManager_Call { - _c.Call.Return(run) - return _c -} - // UpdateChainConfig provides a mock function with given fields: ctx, cfg func (_m *Service) UpdateChainConfig(ctx context.Context, cfg feeds.ChainConfig) (int64, error) { ret := _m.Called(ctx, cfg) diff --git a/core/services/feeds/service.go b/core/services/feeds/service.go index 6dd855787f..e2eadec0c9 100644 --- a/core/services/feeds/service.go +++ b/core/services/feeds/service.go @@ -17,6 +17,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" + "github.com/smartcontractkit/chainlink/v2/plugins" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" @@ -107,8 +108,6 @@ type Service interface { ListSpecsByJobProposalIDs(ctx context.Context, ids []int64) ([]JobProposalSpec, error) RejectSpec(ctx context.Context, id int64) error UpdateSpecDefinition(ctx context.Context, id int64, spec string) error - - Unsafe_SetConnectionsManager(ConnectionsManager) } type service struct { @@ -1130,16 +1129,6 @@ func findExistingJobForOCR2(ctx context.Context, j *job.Job, tx job.ORM) (int32, return tx.FindOCR2JobIDByAddress(ctx, contractID, feedID) } -// Unsafe_SetConnectionsManager sets the ConnectionsManager on the service. -// -// We need to be able to inject a mock for the client to facilitate integration -// tests. -// -// ONLY TO BE USED FOR TESTING. -func (s *service) Unsafe_SetConnectionsManager(connMgr ConnectionsManager) { - s.connMgr = connMgr -} - // findExistingJobForOCRFlux looks for existing job for OCR or flux func findExistingJobForOCRFlux(ctx context.Context, j *job.Job, tx job.ORM) (int32, error) { var address types.EIP55Address @@ -1507,6 +1496,5 @@ func (ns NullService) IsJobManaged(ctx context.Context, jobID int64) (bool, erro func (ns NullService) UpdateSpecDefinition(ctx context.Context, id int64, spec string) error { return ErrFeedsManagerDisabled } -func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager) {} //revive:enable diff --git a/core/services/ocr2/plugins/ccip/testhelpers/integration/chainlink.go b/core/services/ocr2/plugins/ccip/testhelpers/integration/chainlink.go index ad42078248..3a7ff08449 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/integration/chainlink.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/integration/chainlink.go @@ -644,7 +644,6 @@ func (c *CCIPIntegrationTestHarness) SetupFeedsManager(t *testing.T) { connManager.On("GetClient", mock.Anything).Maybe().Return(NoopFeedsClient{}, nil) connManager.On("Close").Maybe().Return() connManager.On("IsConnected", mock.Anything).Maybe().Return(true) - f.Unsafe_SetConnectionsManager(connManager) _, err = f.RegisterManager(testutils.Context(t), m) require.NoError(t, err) diff --git a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/chainlink.go b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/chainlink.go index f406ea0e94..3f0fc7f112 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/chainlink.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/chainlink.go @@ -642,7 +642,6 @@ func (c *CCIPIntegrationTestHarness) SetupFeedsManager(t *testing.T) { connManager.On("GetClient", mock.Anything).Maybe().Return(NoopFeedsClient{}, nil) connManager.On("Close").Maybe().Return() connManager.On("IsConnected", mock.Anything).Maybe().Return(true) - f.Unsafe_SetConnectionsManager(connManager) } }