Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BCF-3269] - Contract Reader Batch Call #13635

Merged
merged 17 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add common codec mock for batch_caller_test
  • Loading branch information
ilija42 committed Jul 12, 2024
commit 14ade151fb28fbd072b8570786ccf8514b649eb7
11 changes: 6 additions & 5 deletions core/services/relay/evm/batch_caller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

commonmocks "github.com/smartcontractkit/chainlink-common/pkg/types/mocks"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks"
chainmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mocks"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types"
)

//go:generate mockery --quiet --name Codec --srcpkg=github.com/smartcontractkit/chainlink-common/pkg/types --output ./mocks/ --case=underscore
func TestDefaultEvmBatchCaller_BatchCallDynamicLimit(t *testing.T) {
testCases := []struct {
name string
Expand Down Expand Up @@ -80,13 +81,13 @@ func TestDefaultEvmBatchCaller_BatchCallDynamicLimit(t *testing.T) {
},
}

mockCodec := commonmocks.NewCodec(t)
mockCodec := mocks.NewCodec(t)
mockCodec.On("Encode", mock.Anything, mock.Anything, mock.Anything).Return([]byte{}, nil)

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
batchSizes := make([]int, 0)
ec := mocks.NewClient(t)
ec := chainmocks.NewClient(t)
ec.On("BatchCallContext", mock.Anything, mock.Anything).Run(func(args mock.Arguments) {
evmCalls := args.Get(1).([]rpc.BatchElem)
batchSizes = append(batchSizes, len(evmCalls))
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestDefaultEvmBatchCaller_batchCallLimit(t *testing.T) {

for i, tc := range testCases {
t.Run(fmt.Sprintf("%v", tc), func(t *testing.T) {
ec := mocks.NewClient(t)
ec := chainmocks.NewClient(t)
calls := make(evm.BatchCall, tc.numCalls)
for j := range calls {
contractName := fmt.Sprintf("testCase_%d", i)
Expand Down
132 changes: 132 additions & 0 deletions core/services/relay/evm/mocks/codec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading