diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 000000000..ef7ae856e --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1 @@ +with-expecter: True \ No newline at end of file diff --git a/abci/preblock/oracle/preblock_test.go b/abci/preblock/oracle/preblock_test.go index 988b22966..ce3501a3f 100644 --- a/abci/preblock/oracle/preblock_test.go +++ b/abci/preblock/oracle/preblock_test.go @@ -292,7 +292,7 @@ func (s *PreBlockTestSuite) TestPreBlocker() { s.Require().NoError(err) validator1 := voteweightedmocks.NewValidatorI(s.T()) - validator1.On("GetBondedTokens").Return(math.NewInt(1)) + validator1.EXPECT().GetBondedTokens().Return(math.NewInt(1)) validator2 := voteweightedmocks.NewValidatorI(s.T()) validator2.On("GetBondedTokens").Return(math.NewInt(1)) diff --git a/abci/strategies/aggregator/mocks/mock_price_applier.go b/abci/strategies/aggregator/mocks/mock_price_applier.go index eedc2a4ad..1ae3070ad 100644 --- a/abci/strategies/aggregator/mocks/mock_price_applier.go +++ b/abci/strategies/aggregator/mocks/mock_price_applier.go @@ -19,6 +19,14 @@ type PriceApplier struct { mock.Mock } +type PriceApplier_Expecter struct { + mock *mock.Mock +} + +func (_m *PriceApplier) EXPECT() *PriceApplier_Expecter { + return &PriceApplier_Expecter{mock: &_m.Mock} +} + // ApplyPricesFromVoteExtensions provides a mock function with given fields: ctx, req func (_m *PriceApplier) ApplyPricesFromVoteExtensions(ctx types.Context, req *abcitypes.RequestFinalizeBlock) (map[pkgtypes.CurrencyPair]*big.Int, error) { ret := _m.Called(ctx, req) @@ -49,6 +57,35 @@ func (_m *PriceApplier) ApplyPricesFromVoteExtensions(ctx types.Context, req *ab return r0, r1 } +// PriceApplier_ApplyPricesFromVoteExtensions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyPricesFromVoteExtensions' +type PriceApplier_ApplyPricesFromVoteExtensions_Call struct { + *mock.Call +} + +// ApplyPricesFromVoteExtensions is a helper method to define mock.On call +// - ctx types.Context +// - req *abcitypes.RequestFinalizeBlock +func (_e *PriceApplier_Expecter) ApplyPricesFromVoteExtensions(ctx interface{}, req interface{}) *PriceApplier_ApplyPricesFromVoteExtensions_Call { + return &PriceApplier_ApplyPricesFromVoteExtensions_Call{Call: _e.mock.On("ApplyPricesFromVoteExtensions", ctx, req)} +} + +func (_c *PriceApplier_ApplyPricesFromVoteExtensions_Call) Run(run func(ctx types.Context, req *abcitypes.RequestFinalizeBlock)) *PriceApplier_ApplyPricesFromVoteExtensions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(*abcitypes.RequestFinalizeBlock)) + }) + return _c +} + +func (_c *PriceApplier_ApplyPricesFromVoteExtensions_Call) Return(_a0 map[pkgtypes.CurrencyPair]*big.Int, _a1 error) *PriceApplier_ApplyPricesFromVoteExtensions_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *PriceApplier_ApplyPricesFromVoteExtensions_Call) RunAndReturn(run func(types.Context, *abcitypes.RequestFinalizeBlock) (map[pkgtypes.CurrencyPair]*big.Int, error)) *PriceApplier_ApplyPricesFromVoteExtensions_Call { + _c.Call.Return(run) + return _c +} + // GetPricesForValidator provides a mock function with given fields: validator func (_m *PriceApplier) GetPricesForValidator(validator types.ConsAddress) map[pkgtypes.CurrencyPair]*big.Int { ret := _m.Called(validator) @@ -69,6 +106,34 @@ func (_m *PriceApplier) GetPricesForValidator(validator types.ConsAddress) map[p return r0 } +// PriceApplier_GetPricesForValidator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPricesForValidator' +type PriceApplier_GetPricesForValidator_Call struct { + *mock.Call +} + +// GetPricesForValidator is a helper method to define mock.On call +// - validator types.ConsAddress +func (_e *PriceApplier_Expecter) GetPricesForValidator(validator interface{}) *PriceApplier_GetPricesForValidator_Call { + return &PriceApplier_GetPricesForValidator_Call{Call: _e.mock.On("GetPricesForValidator", validator)} +} + +func (_c *PriceApplier_GetPricesForValidator_Call) Run(run func(validator types.ConsAddress)) *PriceApplier_GetPricesForValidator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.ConsAddress)) + }) + return _c +} + +func (_c *PriceApplier_GetPricesForValidator_Call) Return(_a0 map[pkgtypes.CurrencyPair]*big.Int) *PriceApplier_GetPricesForValidator_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PriceApplier_GetPricesForValidator_Call) RunAndReturn(run func(types.ConsAddress) map[pkgtypes.CurrencyPair]*big.Int) *PriceApplier_GetPricesForValidator_Call { + _c.Call.Return(run) + return _c +} + // NewPriceApplier creates a new instance of PriceApplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewPriceApplier(t interface { diff --git a/abci/strategies/aggregator/mocks/mock_vote_aggregator.go b/abci/strategies/aggregator/mocks/mock_vote_aggregator.go index 15dc7f35d..0b25ebce1 100644 --- a/abci/strategies/aggregator/mocks/mock_vote_aggregator.go +++ b/abci/strategies/aggregator/mocks/mock_vote_aggregator.go @@ -19,6 +19,14 @@ type VoteAggregator struct { mock.Mock } +type VoteAggregator_Expecter struct { + mock *mock.Mock +} + +func (_m *VoteAggregator) EXPECT() *VoteAggregator_Expecter { + return &VoteAggregator_Expecter{mock: &_m.Mock} +} + // AggregateOracleVotes provides a mock function with given fields: ctx, votes func (_m *VoteAggregator) AggregateOracleVotes(ctx types.Context, votes []aggregator.Vote) (map[pkgtypes.CurrencyPair]*big.Int, error) { ret := _m.Called(ctx, votes) @@ -49,6 +57,35 @@ func (_m *VoteAggregator) AggregateOracleVotes(ctx types.Context, votes []aggreg return r0, r1 } +// VoteAggregator_AggregateOracleVotes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AggregateOracleVotes' +type VoteAggregator_AggregateOracleVotes_Call struct { + *mock.Call +} + +// AggregateOracleVotes is a helper method to define mock.On call +// - ctx types.Context +// - votes []aggregator.Vote +func (_e *VoteAggregator_Expecter) AggregateOracleVotes(ctx interface{}, votes interface{}) *VoteAggregator_AggregateOracleVotes_Call { + return &VoteAggregator_AggregateOracleVotes_Call{Call: _e.mock.On("AggregateOracleVotes", ctx, votes)} +} + +func (_c *VoteAggregator_AggregateOracleVotes_Call) Run(run func(ctx types.Context, votes []aggregator.Vote)) *VoteAggregator_AggregateOracleVotes_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].([]aggregator.Vote)) + }) + return _c +} + +func (_c *VoteAggregator_AggregateOracleVotes_Call) Return(_a0 map[pkgtypes.CurrencyPair]*big.Int, _a1 error) *VoteAggregator_AggregateOracleVotes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *VoteAggregator_AggregateOracleVotes_Call) RunAndReturn(run func(types.Context, []aggregator.Vote) (map[pkgtypes.CurrencyPair]*big.Int, error)) *VoteAggregator_AggregateOracleVotes_Call { + _c.Call.Return(run) + return _c +} + // GetPriceForValidator provides a mock function with given fields: validator func (_m *VoteAggregator) GetPriceForValidator(validator types.ConsAddress) map[pkgtypes.CurrencyPair]*big.Int { ret := _m.Called(validator) @@ -69,6 +106,34 @@ func (_m *VoteAggregator) GetPriceForValidator(validator types.ConsAddress) map[ return r0 } +// VoteAggregator_GetPriceForValidator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPriceForValidator' +type VoteAggregator_GetPriceForValidator_Call struct { + *mock.Call +} + +// GetPriceForValidator is a helper method to define mock.On call +// - validator types.ConsAddress +func (_e *VoteAggregator_Expecter) GetPriceForValidator(validator interface{}) *VoteAggregator_GetPriceForValidator_Call { + return &VoteAggregator_GetPriceForValidator_Call{Call: _e.mock.On("GetPriceForValidator", validator)} +} + +func (_c *VoteAggregator_GetPriceForValidator_Call) Run(run func(validator types.ConsAddress)) *VoteAggregator_GetPriceForValidator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.ConsAddress)) + }) + return _c +} + +func (_c *VoteAggregator_GetPriceForValidator_Call) Return(_a0 map[pkgtypes.CurrencyPair]*big.Int) *VoteAggregator_GetPriceForValidator_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *VoteAggregator_GetPriceForValidator_Call) RunAndReturn(run func(types.ConsAddress) map[pkgtypes.CurrencyPair]*big.Int) *VoteAggregator_GetPriceForValidator_Call { + _c.Call.Return(run) + return _c +} + // NewVoteAggregator creates a new instance of VoteAggregator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewVoteAggregator(t interface { diff --git a/abci/strategies/codec/mocks/extended_commit_codec.go b/abci/strategies/codec/mocks/extended_commit_codec.go index 4a9f2db60..b546df2eb 100644 --- a/abci/strategies/codec/mocks/extended_commit_codec.go +++ b/abci/strategies/codec/mocks/extended_commit_codec.go @@ -12,6 +12,14 @@ type ExtendedCommitCodec struct { mock.Mock } +type ExtendedCommitCodec_Expecter struct { + mock *mock.Mock +} + +func (_m *ExtendedCommitCodec) EXPECT() *ExtendedCommitCodec_Expecter { + return &ExtendedCommitCodec_Expecter{mock: &_m.Mock} +} + // Decode provides a mock function with given fields: _a0 func (_m *ExtendedCommitCodec) Decode(_a0 []byte) (types.ExtendedCommitInfo, error) { ret := _m.Called(_a0) @@ -40,6 +48,34 @@ func (_m *ExtendedCommitCodec) Decode(_a0 []byte) (types.ExtendedCommitInfo, err return r0, r1 } +// ExtendedCommitCodec_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode' +type ExtendedCommitCodec_Decode_Call struct { + *mock.Call +} + +// Decode is a helper method to define mock.On call +// - _a0 []byte +func (_e *ExtendedCommitCodec_Expecter) Decode(_a0 interface{}) *ExtendedCommitCodec_Decode_Call { + return &ExtendedCommitCodec_Decode_Call{Call: _e.mock.On("Decode", _a0)} +} + +func (_c *ExtendedCommitCodec_Decode_Call) Run(run func(_a0 []byte)) *ExtendedCommitCodec_Decode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *ExtendedCommitCodec_Decode_Call) Return(_a0 types.ExtendedCommitInfo, _a1 error) *ExtendedCommitCodec_Decode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ExtendedCommitCodec_Decode_Call) RunAndReturn(run func([]byte) (types.ExtendedCommitInfo, error)) *ExtendedCommitCodec_Decode_Call { + _c.Call.Return(run) + return _c +} + // Encode provides a mock function with given fields: _a0 func (_m *ExtendedCommitCodec) Encode(_a0 types.ExtendedCommitInfo) ([]byte, error) { ret := _m.Called(_a0) @@ -70,6 +106,34 @@ func (_m *ExtendedCommitCodec) Encode(_a0 types.ExtendedCommitInfo) ([]byte, err return r0, r1 } +// ExtendedCommitCodec_Encode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Encode' +type ExtendedCommitCodec_Encode_Call struct { + *mock.Call +} + +// Encode is a helper method to define mock.On call +// - _a0 types.ExtendedCommitInfo +func (_e *ExtendedCommitCodec_Expecter) Encode(_a0 interface{}) *ExtendedCommitCodec_Encode_Call { + return &ExtendedCommitCodec_Encode_Call{Call: _e.mock.On("Encode", _a0)} +} + +func (_c *ExtendedCommitCodec_Encode_Call) Run(run func(_a0 types.ExtendedCommitInfo)) *ExtendedCommitCodec_Encode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.ExtendedCommitInfo)) + }) + return _c +} + +func (_c *ExtendedCommitCodec_Encode_Call) Return(_a0 []byte, _a1 error) *ExtendedCommitCodec_Encode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ExtendedCommitCodec_Encode_Call) RunAndReturn(run func(types.ExtendedCommitInfo) ([]byte, error)) *ExtendedCommitCodec_Encode_Call { + _c.Call.Return(run) + return _c +} + // NewExtendedCommitCodec creates a new instance of ExtendedCommitCodec. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewExtendedCommitCodec(t interface { diff --git a/abci/strategies/codec/mocks/vote_extension_codec.go b/abci/strategies/codec/mocks/vote_extension_codec.go index d21371b3d..06eb5849e 100644 --- a/abci/strategies/codec/mocks/vote_extension_codec.go +++ b/abci/strategies/codec/mocks/vote_extension_codec.go @@ -13,6 +13,14 @@ type VoteExtensionCodec struct { mock.Mock } +type VoteExtensionCodec_Expecter struct { + mock *mock.Mock +} + +func (_m *VoteExtensionCodec) EXPECT() *VoteExtensionCodec_Expecter { + return &VoteExtensionCodec_Expecter{mock: &_m.Mock} +} + // Decode provides a mock function with given fields: _a0 func (_m *VoteExtensionCodec) Decode(_a0 []byte) (types.OracleVoteExtension, error) { ret := _m.Called(_a0) @@ -41,6 +49,34 @@ func (_m *VoteExtensionCodec) Decode(_a0 []byte) (types.OracleVoteExtension, err return r0, r1 } +// VoteExtensionCodec_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode' +type VoteExtensionCodec_Decode_Call struct { + *mock.Call +} + +// Decode is a helper method to define mock.On call +// - _a0 []byte +func (_e *VoteExtensionCodec_Expecter) Decode(_a0 interface{}) *VoteExtensionCodec_Decode_Call { + return &VoteExtensionCodec_Decode_Call{Call: _e.mock.On("Decode", _a0)} +} + +func (_c *VoteExtensionCodec_Decode_Call) Run(run func(_a0 []byte)) *VoteExtensionCodec_Decode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *VoteExtensionCodec_Decode_Call) Return(_a0 types.OracleVoteExtension, _a1 error) *VoteExtensionCodec_Decode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *VoteExtensionCodec_Decode_Call) RunAndReturn(run func([]byte) (types.OracleVoteExtension, error)) *VoteExtensionCodec_Decode_Call { + _c.Call.Return(run) + return _c +} + // Encode provides a mock function with given fields: ve func (_m *VoteExtensionCodec) Encode(ve types.OracleVoteExtension) ([]byte, error) { ret := _m.Called(ve) @@ -71,6 +107,34 @@ func (_m *VoteExtensionCodec) Encode(ve types.OracleVoteExtension) ([]byte, erro return r0, r1 } +// VoteExtensionCodec_Encode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Encode' +type VoteExtensionCodec_Encode_Call struct { + *mock.Call +} + +// Encode is a helper method to define mock.On call +// - ve types.OracleVoteExtension +func (_e *VoteExtensionCodec_Expecter) Encode(ve interface{}) *VoteExtensionCodec_Encode_Call { + return &VoteExtensionCodec_Encode_Call{Call: _e.mock.On("Encode", ve)} +} + +func (_c *VoteExtensionCodec_Encode_Call) Run(run func(ve types.OracleVoteExtension)) *VoteExtensionCodec_Encode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.OracleVoteExtension)) + }) + return _c +} + +func (_c *VoteExtensionCodec_Encode_Call) Return(_a0 []byte, _a1 error) *VoteExtensionCodec_Encode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *VoteExtensionCodec_Encode_Call) RunAndReturn(run func(types.OracleVoteExtension) ([]byte, error)) *VoteExtensionCodec_Encode_Call { + _c.Call.Return(run) + return _c +} + // NewVoteExtensionCodec creates a new instance of VoteExtensionCodec. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewVoteExtensionCodec(t interface { diff --git a/abci/strategies/currencypair/mocks/mock_currency_pair_strategy.go b/abci/strategies/currencypair/mocks/mock_currency_pair_strategy.go index 16a4ef6e5..bbd80104a 100644 --- a/abci/strategies/currencypair/mocks/mock_currency_pair_strategy.go +++ b/abci/strategies/currencypair/mocks/mock_currency_pair_strategy.go @@ -17,6 +17,14 @@ type CurrencyPairStrategy struct { mock.Mock } +type CurrencyPairStrategy_Expecter struct { + mock *mock.Mock +} + +func (_m *CurrencyPairStrategy) EXPECT() *CurrencyPairStrategy_Expecter { + return &CurrencyPairStrategy_Expecter{mock: &_m.Mock} +} + // FromID provides a mock function with given fields: ctx, id func (_m *CurrencyPairStrategy) FromID(ctx types.Context, id uint64) (pkgtypes.CurrencyPair, error) { ret := _m.Called(ctx, id) @@ -45,6 +53,35 @@ func (_m *CurrencyPairStrategy) FromID(ctx types.Context, id uint64) (pkgtypes.C return r0, r1 } +// CurrencyPairStrategy_FromID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FromID' +type CurrencyPairStrategy_FromID_Call struct { + *mock.Call +} + +// FromID is a helper method to define mock.On call +// - ctx types.Context +// - id uint64 +func (_e *CurrencyPairStrategy_Expecter) FromID(ctx interface{}, id interface{}) *CurrencyPairStrategy_FromID_Call { + return &CurrencyPairStrategy_FromID_Call{Call: _e.mock.On("FromID", ctx, id)} +} + +func (_c *CurrencyPairStrategy_FromID_Call) Run(run func(ctx types.Context, id uint64)) *CurrencyPairStrategy_FromID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *CurrencyPairStrategy_FromID_Call) Return(_a0 pkgtypes.CurrencyPair, _a1 error) *CurrencyPairStrategy_FromID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CurrencyPairStrategy_FromID_Call) RunAndReturn(run func(types.Context, uint64) (pkgtypes.CurrencyPair, error)) *CurrencyPairStrategy_FromID_Call { + _c.Call.Return(run) + return _c +} + // GetDecodedPrice provides a mock function with given fields: ctx, cp, priceBytes func (_m *CurrencyPairStrategy) GetDecodedPrice(ctx types.Context, cp pkgtypes.CurrencyPair, priceBytes []byte) (*big.Int, error) { ret := _m.Called(ctx, cp, priceBytes) @@ -75,6 +112,36 @@ func (_m *CurrencyPairStrategy) GetDecodedPrice(ctx types.Context, cp pkgtypes.C return r0, r1 } +// CurrencyPairStrategy_GetDecodedPrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDecodedPrice' +type CurrencyPairStrategy_GetDecodedPrice_Call struct { + *mock.Call +} + +// GetDecodedPrice is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +// - priceBytes []byte +func (_e *CurrencyPairStrategy_Expecter) GetDecodedPrice(ctx interface{}, cp interface{}, priceBytes interface{}) *CurrencyPairStrategy_GetDecodedPrice_Call { + return &CurrencyPairStrategy_GetDecodedPrice_Call{Call: _e.mock.On("GetDecodedPrice", ctx, cp, priceBytes)} +} + +func (_c *CurrencyPairStrategy_GetDecodedPrice_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair, priceBytes []byte)) *CurrencyPairStrategy_GetDecodedPrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair), args[2].([]byte)) + }) + return _c +} + +func (_c *CurrencyPairStrategy_GetDecodedPrice_Call) Return(_a0 *big.Int, _a1 error) *CurrencyPairStrategy_GetDecodedPrice_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CurrencyPairStrategy_GetDecodedPrice_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair, []byte) (*big.Int, error)) *CurrencyPairStrategy_GetDecodedPrice_Call { + _c.Call.Return(run) + return _c +} + // GetEncodedPrice provides a mock function with given fields: ctx, cp, price func (_m *CurrencyPairStrategy) GetEncodedPrice(ctx types.Context, cp pkgtypes.CurrencyPair, price *big.Int) ([]byte, error) { ret := _m.Called(ctx, cp, price) @@ -105,6 +172,36 @@ func (_m *CurrencyPairStrategy) GetEncodedPrice(ctx types.Context, cp pkgtypes.C return r0, r1 } +// CurrencyPairStrategy_GetEncodedPrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEncodedPrice' +type CurrencyPairStrategy_GetEncodedPrice_Call struct { + *mock.Call +} + +// GetEncodedPrice is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +// - price *big.Int +func (_e *CurrencyPairStrategy_Expecter) GetEncodedPrice(ctx interface{}, cp interface{}, price interface{}) *CurrencyPairStrategy_GetEncodedPrice_Call { + return &CurrencyPairStrategy_GetEncodedPrice_Call{Call: _e.mock.On("GetEncodedPrice", ctx, cp, price)} +} + +func (_c *CurrencyPairStrategy_GetEncodedPrice_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair, price *big.Int)) *CurrencyPairStrategy_GetEncodedPrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair), args[2].(*big.Int)) + }) + return _c +} + +func (_c *CurrencyPairStrategy_GetEncodedPrice_Call) Return(_a0 []byte, _a1 error) *CurrencyPairStrategy_GetEncodedPrice_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CurrencyPairStrategy_GetEncodedPrice_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair, *big.Int) ([]byte, error)) *CurrencyPairStrategy_GetEncodedPrice_Call { + _c.Call.Return(run) + return _c +} + // GetMaxNumCP provides a mock function with given fields: ctx func (_m *CurrencyPairStrategy) GetMaxNumCP(ctx types.Context) (uint64, error) { ret := _m.Called(ctx) @@ -133,6 +230,34 @@ func (_m *CurrencyPairStrategy) GetMaxNumCP(ctx types.Context) (uint64, error) { return r0, r1 } +// CurrencyPairStrategy_GetMaxNumCP_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMaxNumCP' +type CurrencyPairStrategy_GetMaxNumCP_Call struct { + *mock.Call +} + +// GetMaxNumCP is a helper method to define mock.On call +// - ctx types.Context +func (_e *CurrencyPairStrategy_Expecter) GetMaxNumCP(ctx interface{}) *CurrencyPairStrategy_GetMaxNumCP_Call { + return &CurrencyPairStrategy_GetMaxNumCP_Call{Call: _e.mock.On("GetMaxNumCP", ctx)} +} + +func (_c *CurrencyPairStrategy_GetMaxNumCP_Call) Run(run func(ctx types.Context)) *CurrencyPairStrategy_GetMaxNumCP_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *CurrencyPairStrategy_GetMaxNumCP_Call) Return(_a0 uint64, _a1 error) *CurrencyPairStrategy_GetMaxNumCP_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CurrencyPairStrategy_GetMaxNumCP_Call) RunAndReturn(run func(types.Context) (uint64, error)) *CurrencyPairStrategy_GetMaxNumCP_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with given fields: ctx, cp func (_m *CurrencyPairStrategy) ID(ctx types.Context, cp pkgtypes.CurrencyPair) (uint64, error) { ret := _m.Called(ctx, cp) @@ -161,6 +286,35 @@ func (_m *CurrencyPairStrategy) ID(ctx types.Context, cp pkgtypes.CurrencyPair) return r0, r1 } +// CurrencyPairStrategy_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type CurrencyPairStrategy_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +func (_e *CurrencyPairStrategy_Expecter) ID(ctx interface{}, cp interface{}) *CurrencyPairStrategy_ID_Call { + return &CurrencyPairStrategy_ID_Call{Call: _e.mock.On("ID", ctx, cp)} +} + +func (_c *CurrencyPairStrategy_ID_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair)) *CurrencyPairStrategy_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair)) + }) + return _c +} + +func (_c *CurrencyPairStrategy_ID_Call) Return(_a0 uint64, _a1 error) *CurrencyPairStrategy_ID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CurrencyPairStrategy_ID_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair) (uint64, error)) *CurrencyPairStrategy_ID_Call { + _c.Call.Return(run) + return _c +} + // NewCurrencyPairStrategy creates a new instance of CurrencyPairStrategy. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCurrencyPairStrategy(t interface { diff --git a/abci/strategies/currencypair/mocks/mock_oracle_keeper.go b/abci/strategies/currencypair/mocks/mock_oracle_keeper.go index 1173fb4f9..b00329659 100644 --- a/abci/strategies/currencypair/mocks/mock_oracle_keeper.go +++ b/abci/strategies/currencypair/mocks/mock_oracle_keeper.go @@ -16,6 +16,14 @@ type OracleKeeper struct { mock.Mock } +type OracleKeeper_Expecter struct { + mock *mock.Mock +} + +func (_m *OracleKeeper) EXPECT() *OracleKeeper_Expecter { + return &OracleKeeper_Expecter{mock: &_m.Mock} +} + // GetAllCurrencyPairs provides a mock function with given fields: ctx func (_m *OracleKeeper) GetAllCurrencyPairs(ctx types.Context) []pkgtypes.CurrencyPair { ret := _m.Called(ctx) @@ -36,6 +44,34 @@ func (_m *OracleKeeper) GetAllCurrencyPairs(ctx types.Context) []pkgtypes.Curren return r0 } +// OracleKeeper_GetAllCurrencyPairs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllCurrencyPairs' +type OracleKeeper_GetAllCurrencyPairs_Call struct { + *mock.Call +} + +// GetAllCurrencyPairs is a helper method to define mock.On call +// - ctx types.Context +func (_e *OracleKeeper_Expecter) GetAllCurrencyPairs(ctx interface{}) *OracleKeeper_GetAllCurrencyPairs_Call { + return &OracleKeeper_GetAllCurrencyPairs_Call{Call: _e.mock.On("GetAllCurrencyPairs", ctx)} +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) Run(run func(ctx types.Context)) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) Return(_a0 []pkgtypes.CurrencyPair) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) RunAndReturn(run func(types.Context) []pkgtypes.CurrencyPair) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Return(run) + return _c +} + // GetCurrencyPairFromID provides a mock function with given fields: ctx, id func (_m *OracleKeeper) GetCurrencyPairFromID(ctx types.Context, id uint64) (pkgtypes.CurrencyPair, bool) { ret := _m.Called(ctx, id) @@ -64,6 +100,35 @@ func (_m *OracleKeeper) GetCurrencyPairFromID(ctx types.Context, id uint64) (pkg return r0, r1 } +// OracleKeeper_GetCurrencyPairFromID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrencyPairFromID' +type OracleKeeper_GetCurrencyPairFromID_Call struct { + *mock.Call +} + +// GetCurrencyPairFromID is a helper method to define mock.On call +// - ctx types.Context +// - id uint64 +func (_e *OracleKeeper_Expecter) GetCurrencyPairFromID(ctx interface{}, id interface{}) *OracleKeeper_GetCurrencyPairFromID_Call { + return &OracleKeeper_GetCurrencyPairFromID_Call{Call: _e.mock.On("GetCurrencyPairFromID", ctx, id)} +} + +func (_c *OracleKeeper_GetCurrencyPairFromID_Call) Run(run func(ctx types.Context, id uint64)) *OracleKeeper_GetCurrencyPairFromID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *OracleKeeper_GetCurrencyPairFromID_Call) Return(cp pkgtypes.CurrencyPair, found bool) *OracleKeeper_GetCurrencyPairFromID_Call { + _c.Call.Return(cp, found) + return _c +} + +func (_c *OracleKeeper_GetCurrencyPairFromID_Call) RunAndReturn(run func(types.Context, uint64) (pkgtypes.CurrencyPair, bool)) *OracleKeeper_GetCurrencyPairFromID_Call { + _c.Call.Return(run) + return _c +} + // GetIDForCurrencyPair provides a mock function with given fields: ctx, cp func (_m *OracleKeeper) GetIDForCurrencyPair(ctx types.Context, cp pkgtypes.CurrencyPair) (uint64, bool) { ret := _m.Called(ctx, cp) @@ -92,6 +157,35 @@ func (_m *OracleKeeper) GetIDForCurrencyPair(ctx types.Context, cp pkgtypes.Curr return r0, r1 } +// OracleKeeper_GetIDForCurrencyPair_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIDForCurrencyPair' +type OracleKeeper_GetIDForCurrencyPair_Call struct { + *mock.Call +} + +// GetIDForCurrencyPair is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +func (_e *OracleKeeper_Expecter) GetIDForCurrencyPair(ctx interface{}, cp interface{}) *OracleKeeper_GetIDForCurrencyPair_Call { + return &OracleKeeper_GetIDForCurrencyPair_Call{Call: _e.mock.On("GetIDForCurrencyPair", ctx, cp)} +} + +func (_c *OracleKeeper_GetIDForCurrencyPair_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair)) *OracleKeeper_GetIDForCurrencyPair_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair)) + }) + return _c +} + +func (_c *OracleKeeper_GetIDForCurrencyPair_Call) Return(_a0 uint64, _a1 bool) *OracleKeeper_GetIDForCurrencyPair_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleKeeper_GetIDForCurrencyPair_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair) (uint64, bool)) *OracleKeeper_GetIDForCurrencyPair_Call { + _c.Call.Return(run) + return _c +} + // GetNumCurrencyPairs provides a mock function with given fields: ctx func (_m *OracleKeeper) GetNumCurrencyPairs(ctx types.Context) (uint64, error) { ret := _m.Called(ctx) @@ -120,6 +214,34 @@ func (_m *OracleKeeper) GetNumCurrencyPairs(ctx types.Context) (uint64, error) { return r0, r1 } +// OracleKeeper_GetNumCurrencyPairs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNumCurrencyPairs' +type OracleKeeper_GetNumCurrencyPairs_Call struct { + *mock.Call +} + +// GetNumCurrencyPairs is a helper method to define mock.On call +// - ctx types.Context +func (_e *OracleKeeper_Expecter) GetNumCurrencyPairs(ctx interface{}) *OracleKeeper_GetNumCurrencyPairs_Call { + return &OracleKeeper_GetNumCurrencyPairs_Call{Call: _e.mock.On("GetNumCurrencyPairs", ctx)} +} + +func (_c *OracleKeeper_GetNumCurrencyPairs_Call) Run(run func(ctx types.Context)) *OracleKeeper_GetNumCurrencyPairs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *OracleKeeper_GetNumCurrencyPairs_Call) Return(_a0 uint64, _a1 error) *OracleKeeper_GetNumCurrencyPairs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleKeeper_GetNumCurrencyPairs_Call) RunAndReturn(run func(types.Context) (uint64, error)) *OracleKeeper_GetNumCurrencyPairs_Call { + _c.Call.Return(run) + return _c +} + // GetNumRemovedCurrencyPairs provides a mock function with given fields: ctx func (_m *OracleKeeper) GetNumRemovedCurrencyPairs(ctx types.Context) (uint64, error) { ret := _m.Called(ctx) @@ -148,6 +270,34 @@ func (_m *OracleKeeper) GetNumRemovedCurrencyPairs(ctx types.Context) (uint64, e return r0, r1 } +// OracleKeeper_GetNumRemovedCurrencyPairs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNumRemovedCurrencyPairs' +type OracleKeeper_GetNumRemovedCurrencyPairs_Call struct { + *mock.Call +} + +// GetNumRemovedCurrencyPairs is a helper method to define mock.On call +// - ctx types.Context +func (_e *OracleKeeper_Expecter) GetNumRemovedCurrencyPairs(ctx interface{}) *OracleKeeper_GetNumRemovedCurrencyPairs_Call { + return &OracleKeeper_GetNumRemovedCurrencyPairs_Call{Call: _e.mock.On("GetNumRemovedCurrencyPairs", ctx)} +} + +func (_c *OracleKeeper_GetNumRemovedCurrencyPairs_Call) Run(run func(ctx types.Context)) *OracleKeeper_GetNumRemovedCurrencyPairs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *OracleKeeper_GetNumRemovedCurrencyPairs_Call) Return(_a0 uint64, _a1 error) *OracleKeeper_GetNumRemovedCurrencyPairs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleKeeper_GetNumRemovedCurrencyPairs_Call) RunAndReturn(run func(types.Context) (uint64, error)) *OracleKeeper_GetNumRemovedCurrencyPairs_Call { + _c.Call.Return(run) + return _c +} + // GetPriceForCurrencyPair provides a mock function with given fields: ctx, cp func (_m *OracleKeeper) GetPriceForCurrencyPair(ctx types.Context, cp pkgtypes.CurrencyPair) (oracletypes.QuotePrice, error) { ret := _m.Called(ctx, cp) @@ -176,6 +326,35 @@ func (_m *OracleKeeper) GetPriceForCurrencyPair(ctx types.Context, cp pkgtypes.C return r0, r1 } +// OracleKeeper_GetPriceForCurrencyPair_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPriceForCurrencyPair' +type OracleKeeper_GetPriceForCurrencyPair_Call struct { + *mock.Call +} + +// GetPriceForCurrencyPair is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +func (_e *OracleKeeper_Expecter) GetPriceForCurrencyPair(ctx interface{}, cp interface{}) *OracleKeeper_GetPriceForCurrencyPair_Call { + return &OracleKeeper_GetPriceForCurrencyPair_Call{Call: _e.mock.On("GetPriceForCurrencyPair", ctx, cp)} +} + +func (_c *OracleKeeper_GetPriceForCurrencyPair_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair)) *OracleKeeper_GetPriceForCurrencyPair_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair)) + }) + return _c +} + +func (_c *OracleKeeper_GetPriceForCurrencyPair_Call) Return(_a0 oracletypes.QuotePrice, _a1 error) *OracleKeeper_GetPriceForCurrencyPair_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleKeeper_GetPriceForCurrencyPair_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair) (oracletypes.QuotePrice, error)) *OracleKeeper_GetPriceForCurrencyPair_Call { + _c.Call.Return(run) + return _c +} + // NewOracleKeeper creates a new instance of OracleKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewOracleKeeper(t interface { diff --git a/abci/types/mocks/mock_oracle_keeper.go b/abci/types/mocks/mock_oracle_keeper.go index a591af29f..e1b46baa4 100644 --- a/abci/types/mocks/mock_oracle_keeper.go +++ b/abci/types/mocks/mock_oracle_keeper.go @@ -16,6 +16,14 @@ type OracleKeeper struct { mock.Mock } +type OracleKeeper_Expecter struct { + mock *mock.Mock +} + +func (_m *OracleKeeper) EXPECT() *OracleKeeper_Expecter { + return &OracleKeeper_Expecter{mock: &_m.Mock} +} + // GetAllCurrencyPairs provides a mock function with given fields: ctx func (_m *OracleKeeper) GetAllCurrencyPairs(ctx types.Context) []pkgtypes.CurrencyPair { ret := _m.Called(ctx) @@ -36,6 +44,34 @@ func (_m *OracleKeeper) GetAllCurrencyPairs(ctx types.Context) []pkgtypes.Curren return r0 } +// OracleKeeper_GetAllCurrencyPairs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllCurrencyPairs' +type OracleKeeper_GetAllCurrencyPairs_Call struct { + *mock.Call +} + +// GetAllCurrencyPairs is a helper method to define mock.On call +// - ctx types.Context +func (_e *OracleKeeper_Expecter) GetAllCurrencyPairs(ctx interface{}) *OracleKeeper_GetAllCurrencyPairs_Call { + return &OracleKeeper_GetAllCurrencyPairs_Call{Call: _e.mock.On("GetAllCurrencyPairs", ctx)} +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) Run(run func(ctx types.Context)) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) Return(_a0 []pkgtypes.CurrencyPair) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleKeeper_GetAllCurrencyPairs_Call) RunAndReturn(run func(types.Context) []pkgtypes.CurrencyPair) *OracleKeeper_GetAllCurrencyPairs_Call { + _c.Call.Return(run) + return _c +} + // SetPriceForCurrencyPair provides a mock function with given fields: ctx, cp, qp func (_m *OracleKeeper) SetPriceForCurrencyPair(ctx types.Context, cp pkgtypes.CurrencyPair, qp oracletypes.QuotePrice) error { ret := _m.Called(ctx, cp, qp) @@ -54,6 +90,36 @@ func (_m *OracleKeeper) SetPriceForCurrencyPair(ctx types.Context, cp pkgtypes.C return r0 } +// OracleKeeper_SetPriceForCurrencyPair_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetPriceForCurrencyPair' +type OracleKeeper_SetPriceForCurrencyPair_Call struct { + *mock.Call +} + +// SetPriceForCurrencyPair is a helper method to define mock.On call +// - ctx types.Context +// - cp pkgtypes.CurrencyPair +// - qp oracletypes.QuotePrice +func (_e *OracleKeeper_Expecter) SetPriceForCurrencyPair(ctx interface{}, cp interface{}, qp interface{}) *OracleKeeper_SetPriceForCurrencyPair_Call { + return &OracleKeeper_SetPriceForCurrencyPair_Call{Call: _e.mock.On("SetPriceForCurrencyPair", ctx, cp, qp)} +} + +func (_c *OracleKeeper_SetPriceForCurrencyPair_Call) Run(run func(ctx types.Context, cp pkgtypes.CurrencyPair, qp oracletypes.QuotePrice)) *OracleKeeper_SetPriceForCurrencyPair_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(pkgtypes.CurrencyPair), args[2].(oracletypes.QuotePrice)) + }) + return _c +} + +func (_c *OracleKeeper_SetPriceForCurrencyPair_Call) Return(_a0 error) *OracleKeeper_SetPriceForCurrencyPair_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleKeeper_SetPriceForCurrencyPair_Call) RunAndReturn(run func(types.Context, pkgtypes.CurrencyPair, oracletypes.QuotePrice) error) *OracleKeeper_SetPriceForCurrencyPair_Call { + _c.Call.Return(run) + return _c +} + // NewOracleKeeper creates a new instance of OracleKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewOracleKeeper(t interface { diff --git a/oracle/metrics/mocks/mock_metrics.go b/oracle/metrics/mocks/mock_metrics.go index 532bc7220..04afdae29 100644 --- a/oracle/metrics/mocks/mock_metrics.go +++ b/oracle/metrics/mocks/mock_metrics.go @@ -9,41 +9,251 @@ type Metrics struct { mock.Mock } +type Metrics_Expecter struct { + mock *mock.Mock +} + +func (_m *Metrics) EXPECT() *Metrics_Expecter { + return &Metrics_Expecter{mock: &_m.Mock} +} + // AddProviderCountForMarket provides a mock function with given fields: market, count func (_m *Metrics) AddProviderCountForMarket(market string, count int) { _m.Called(market, count) } +// Metrics_AddProviderCountForMarket_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddProviderCountForMarket' +type Metrics_AddProviderCountForMarket_Call struct { + *mock.Call +} + +// AddProviderCountForMarket is a helper method to define mock.On call +// - market string +// - count int +func (_e *Metrics_Expecter) AddProviderCountForMarket(market interface{}, count interface{}) *Metrics_AddProviderCountForMarket_Call { + return &Metrics_AddProviderCountForMarket_Call{Call: _e.mock.On("AddProviderCountForMarket", market, count)} +} + +func (_c *Metrics_AddProviderCountForMarket_Call) Run(run func(market string, count int)) *Metrics_AddProviderCountForMarket_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(int)) + }) + return _c +} + +func (_c *Metrics_AddProviderCountForMarket_Call) Return() *Metrics_AddProviderCountForMarket_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddProviderCountForMarket_Call) RunAndReturn(run func(string, int)) *Metrics_AddProviderCountForMarket_Call { + _c.Call.Return(run) + return _c +} + // AddProviderTick provides a mock function with given fields: providerName, pairID, success func (_m *Metrics) AddProviderTick(providerName string, pairID string, success bool) { _m.Called(providerName, pairID, success) } +// Metrics_AddProviderTick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddProviderTick' +type Metrics_AddProviderTick_Call struct { + *mock.Call +} + +// AddProviderTick is a helper method to define mock.On call +// - providerName string +// - pairID string +// - success bool +func (_e *Metrics_Expecter) AddProviderTick(providerName interface{}, pairID interface{}, success interface{}) *Metrics_AddProviderTick_Call { + return &Metrics_AddProviderTick_Call{Call: _e.mock.On("AddProviderTick", providerName, pairID, success)} +} + +func (_c *Metrics_AddProviderTick_Call) Run(run func(providerName string, pairID string, success bool)) *Metrics_AddProviderTick_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(bool)) + }) + return _c +} + +func (_c *Metrics_AddProviderTick_Call) Return() *Metrics_AddProviderTick_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddProviderTick_Call) RunAndReturn(run func(string, string, bool)) *Metrics_AddProviderTick_Call { + _c.Call.Return(run) + return _c +} + // AddTick provides a mock function with given fields: func (_m *Metrics) AddTick() { _m.Called() } +// Metrics_AddTick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddTick' +type Metrics_AddTick_Call struct { + *mock.Call +} + +// AddTick is a helper method to define mock.On call +func (_e *Metrics_Expecter) AddTick() *Metrics_AddTick_Call { + return &Metrics_AddTick_Call{Call: _e.mock.On("AddTick")} +} + +func (_c *Metrics_AddTick_Call) Run(run func()) *Metrics_AddTick_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Metrics_AddTick_Call) Return() *Metrics_AddTick_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddTick_Call) RunAndReturn(run func()) *Metrics_AddTick_Call { + _c.Call.Return(run) + return _c +} + // AddTickerTick provides a mock function with given fields: ticker func (_m *Metrics) AddTickerTick(ticker string) { _m.Called(ticker) } +// Metrics_AddTickerTick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddTickerTick' +type Metrics_AddTickerTick_Call struct { + *mock.Call +} + +// AddTickerTick is a helper method to define mock.On call +// - ticker string +func (_e *Metrics_Expecter) AddTickerTick(ticker interface{}) *Metrics_AddTickerTick_Call { + return &Metrics_AddTickerTick_Call{Call: _e.mock.On("AddTickerTick", ticker)} +} + +func (_c *Metrics_AddTickerTick_Call) Run(run func(ticker string)) *Metrics_AddTickerTick_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Metrics_AddTickerTick_Call) Return() *Metrics_AddTickerTick_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddTickerTick_Call) RunAndReturn(run func(string)) *Metrics_AddTickerTick_Call { + _c.Call.Return(run) + return _c +} + // SetSlinkyBuildInfo provides a mock function with given fields: func (_m *Metrics) SetSlinkyBuildInfo() { _m.Called() } +// Metrics_SetSlinkyBuildInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetSlinkyBuildInfo' +type Metrics_SetSlinkyBuildInfo_Call struct { + *mock.Call +} + +// SetSlinkyBuildInfo is a helper method to define mock.On call +func (_e *Metrics_Expecter) SetSlinkyBuildInfo() *Metrics_SetSlinkyBuildInfo_Call { + return &Metrics_SetSlinkyBuildInfo_Call{Call: _e.mock.On("SetSlinkyBuildInfo")} +} + +func (_c *Metrics_SetSlinkyBuildInfo_Call) Run(run func()) *Metrics_SetSlinkyBuildInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Metrics_SetSlinkyBuildInfo_Call) Return() *Metrics_SetSlinkyBuildInfo_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_SetSlinkyBuildInfo_Call) RunAndReturn(run func()) *Metrics_SetSlinkyBuildInfo_Call { + _c.Call.Return(run) + return _c +} + // UpdateAggregatePrice provides a mock function with given fields: pairID, decimals, price func (_m *Metrics) UpdateAggregatePrice(pairID string, decimals uint64, price float64) { _m.Called(pairID, decimals, price) } +// Metrics_UpdateAggregatePrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAggregatePrice' +type Metrics_UpdateAggregatePrice_Call struct { + *mock.Call +} + +// UpdateAggregatePrice is a helper method to define mock.On call +// - pairID string +// - decimals uint64 +// - price float64 +func (_e *Metrics_Expecter) UpdateAggregatePrice(pairID interface{}, decimals interface{}, price interface{}) *Metrics_UpdateAggregatePrice_Call { + return &Metrics_UpdateAggregatePrice_Call{Call: _e.mock.On("UpdateAggregatePrice", pairID, decimals, price)} +} + +func (_c *Metrics_UpdateAggregatePrice_Call) Run(run func(pairID string, decimals uint64, price float64)) *Metrics_UpdateAggregatePrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(uint64), args[2].(float64)) + }) + return _c +} + +func (_c *Metrics_UpdateAggregatePrice_Call) Return() *Metrics_UpdateAggregatePrice_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_UpdateAggregatePrice_Call) RunAndReturn(run func(string, uint64, float64)) *Metrics_UpdateAggregatePrice_Call { + _c.Call.Return(run) + return _c +} + // UpdatePrice provides a mock function with given fields: name, pairID, decimals, price func (_m *Metrics) UpdatePrice(name string, pairID string, decimals uint64, price float64) { _m.Called(name, pairID, decimals, price) } +// Metrics_UpdatePrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePrice' +type Metrics_UpdatePrice_Call struct { + *mock.Call +} + +// UpdatePrice is a helper method to define mock.On call +// - name string +// - pairID string +// - decimals uint64 +// - price float64 +func (_e *Metrics_Expecter) UpdatePrice(name interface{}, pairID interface{}, decimals interface{}, price interface{}) *Metrics_UpdatePrice_Call { + return &Metrics_UpdatePrice_Call{Call: _e.mock.On("UpdatePrice", name, pairID, decimals, price)} +} + +func (_c *Metrics_UpdatePrice_Call) Run(run func(name string, pairID string, decimals uint64, price float64)) *Metrics_UpdatePrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(uint64), args[3].(float64)) + }) + return _c +} + +func (_c *Metrics_UpdatePrice_Call) Return() *Metrics_UpdatePrice_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_UpdatePrice_Call) RunAndReturn(run func(string, string, uint64, float64)) *Metrics_UpdatePrice_Call { + _c.Call.Return(run) + return _c +} + // NewMetrics creates a new instance of Metrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMetrics(t interface { diff --git a/oracle/metrics/mocks/mock_node_client.go b/oracle/metrics/mocks/mock_node_client.go index 2207f0752..5e40719cb 100644 --- a/oracle/metrics/mocks/mock_node_client.go +++ b/oracle/metrics/mocks/mock_node_client.go @@ -9,6 +9,14 @@ type NodeClient struct { mock.Mock } +type NodeClient_Expecter struct { + mock *mock.Mock +} + +func (_m *NodeClient) EXPECT() *NodeClient_Expecter { + return &NodeClient_Expecter{mock: &_m.Mock} +} + // DeriveNodeIdentifier provides a mock function with given fields: func (_m *NodeClient) DeriveNodeIdentifier() (string, error) { ret := _m.Called() @@ -37,6 +45,33 @@ func (_m *NodeClient) DeriveNodeIdentifier() (string, error) { return r0, r1 } +// NodeClient_DeriveNodeIdentifier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeriveNodeIdentifier' +type NodeClient_DeriveNodeIdentifier_Call struct { + *mock.Call +} + +// DeriveNodeIdentifier is a helper method to define mock.On call +func (_e *NodeClient_Expecter) DeriveNodeIdentifier() *NodeClient_DeriveNodeIdentifier_Call { + return &NodeClient_DeriveNodeIdentifier_Call{Call: _e.mock.On("DeriveNodeIdentifier")} +} + +func (_c *NodeClient_DeriveNodeIdentifier_Call) Run(run func()) *NodeClient_DeriveNodeIdentifier_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *NodeClient_DeriveNodeIdentifier_Call) Return(_a0 string, _a1 error) *NodeClient_DeriveNodeIdentifier_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *NodeClient_DeriveNodeIdentifier_Call) RunAndReturn(run func() (string, error)) *NodeClient_DeriveNodeIdentifier_Call { + _c.Call.Return(run) + return _c +} + // NewNodeClient creates a new instance of NodeClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewNodeClient(t interface { diff --git a/oracle/metrics/node_test.go b/oracle/metrics/node_test.go index 6028d20bb..fc3dd1b90 100644 --- a/oracle/metrics/node_test.go +++ b/oracle/metrics/node_test.go @@ -8,11 +8,12 @@ import ( p2p "github.com/cometbft/cometbft/proto/tendermint/p2p" cmtservice "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" - "github.com/skip-mev/connect/v2/oracle/config" - oraclemetrics "github.com/skip-mev/connect/v2/oracle/metrics" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/reflection" + + "github.com/skip-mev/connect/v2/oracle/config" + oraclemetrics "github.com/skip-mev/connect/v2/oracle/metrics" ) // mocks a remote sdk grpc service. diff --git a/oracle/mocks/PriceAggregator.go b/oracle/mocks/PriceAggregator.go index bf9caaeb6..7ef7a02d5 100644 --- a/oracle/mocks/PriceAggregator.go +++ b/oracle/mocks/PriceAggregator.go @@ -15,11 +15,46 @@ type PriceAggregator struct { mock.Mock } +type PriceAggregator_Expecter struct { + mock *mock.Mock +} + +func (_m *PriceAggregator) EXPECT() *PriceAggregator_Expecter { + return &PriceAggregator_Expecter{mock: &_m.Mock} +} + // AggregatePrices provides a mock function with given fields: func (_m *PriceAggregator) AggregatePrices() { _m.Called() } +// PriceAggregator_AggregatePrices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AggregatePrices' +type PriceAggregator_AggregatePrices_Call struct { + *mock.Call +} + +// AggregatePrices is a helper method to define mock.On call +func (_e *PriceAggregator_Expecter) AggregatePrices() *PriceAggregator_AggregatePrices_Call { + return &PriceAggregator_AggregatePrices_Call{Call: _e.mock.On("AggregatePrices")} +} + +func (_c *PriceAggregator_AggregatePrices_Call) Run(run func()) *PriceAggregator_AggregatePrices_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PriceAggregator_AggregatePrices_Call) Return() *PriceAggregator_AggregatePrices_Call { + _c.Call.Return() + return _c +} + +func (_c *PriceAggregator_AggregatePrices_Call) RunAndReturn(run func()) *PriceAggregator_AggregatePrices_Call { + _c.Call.Return(run) + return _c +} + // GetPrices provides a mock function with given fields: func (_m *PriceAggregator) GetPrices() map[string]*big.Float { ret := _m.Called() @@ -40,21 +75,132 @@ func (_m *PriceAggregator) GetPrices() map[string]*big.Float { return r0 } +// PriceAggregator_GetPrices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrices' +type PriceAggregator_GetPrices_Call struct { + *mock.Call +} + +// GetPrices is a helper method to define mock.On call +func (_e *PriceAggregator_Expecter) GetPrices() *PriceAggregator_GetPrices_Call { + return &PriceAggregator_GetPrices_Call{Call: _e.mock.On("GetPrices")} +} + +func (_c *PriceAggregator_GetPrices_Call) Run(run func()) *PriceAggregator_GetPrices_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PriceAggregator_GetPrices_Call) Return(_a0 map[string]*big.Float) *PriceAggregator_GetPrices_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *PriceAggregator_GetPrices_Call) RunAndReturn(run func() map[string]*big.Float) *PriceAggregator_GetPrices_Call { + _c.Call.Return(run) + return _c +} + // Reset provides a mock function with given fields: func (_m *PriceAggregator) Reset() { _m.Called() } +// PriceAggregator_Reset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Reset' +type PriceAggregator_Reset_Call struct { + *mock.Call +} + +// Reset is a helper method to define mock.On call +func (_e *PriceAggregator_Expecter) Reset() *PriceAggregator_Reset_Call { + return &PriceAggregator_Reset_Call{Call: _e.mock.On("Reset")} +} + +func (_c *PriceAggregator_Reset_Call) Run(run func()) *PriceAggregator_Reset_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *PriceAggregator_Reset_Call) Return() *PriceAggregator_Reset_Call { + _c.Call.Return() + return _c +} + +func (_c *PriceAggregator_Reset_Call) RunAndReturn(run func()) *PriceAggregator_Reset_Call { + _c.Call.Return(run) + return _c +} + // SetProviderPrices provides a mock function with given fields: provider, prices func (_m *PriceAggregator) SetProviderPrices(provider string, prices map[string]*big.Float) { _m.Called(provider, prices) } +// PriceAggregator_SetProviderPrices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetProviderPrices' +type PriceAggregator_SetProviderPrices_Call struct { + *mock.Call +} + +// SetProviderPrices is a helper method to define mock.On call +// - provider string +// - prices map[string]*big.Float +func (_e *PriceAggregator_Expecter) SetProviderPrices(provider interface{}, prices interface{}) *PriceAggregator_SetProviderPrices_Call { + return &PriceAggregator_SetProviderPrices_Call{Call: _e.mock.On("SetProviderPrices", provider, prices)} +} + +func (_c *PriceAggregator_SetProviderPrices_Call) Run(run func(provider string, prices map[string]*big.Float)) *PriceAggregator_SetProviderPrices_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(map[string]*big.Float)) + }) + return _c +} + +func (_c *PriceAggregator_SetProviderPrices_Call) Return() *PriceAggregator_SetProviderPrices_Call { + _c.Call.Return() + return _c +} + +func (_c *PriceAggregator_SetProviderPrices_Call) RunAndReturn(run func(string, map[string]*big.Float)) *PriceAggregator_SetProviderPrices_Call { + _c.Call.Return(run) + return _c +} + // UpdateMarketMap provides a mock function with given fields: _a0 func (_m *PriceAggregator) UpdateMarketMap(_a0 types.MarketMap) { _m.Called(_a0) } +// PriceAggregator_UpdateMarketMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateMarketMap' +type PriceAggregator_UpdateMarketMap_Call struct { + *mock.Call +} + +// UpdateMarketMap is a helper method to define mock.On call +// - _a0 types.MarketMap +func (_e *PriceAggregator_Expecter) UpdateMarketMap(_a0 interface{}) *PriceAggregator_UpdateMarketMap_Call { + return &PriceAggregator_UpdateMarketMap_Call{Call: _e.mock.On("UpdateMarketMap", _a0)} +} + +func (_c *PriceAggregator_UpdateMarketMap_Call) Run(run func(_a0 types.MarketMap)) *PriceAggregator_UpdateMarketMap_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.MarketMap)) + }) + return _c +} + +func (_c *PriceAggregator_UpdateMarketMap_Call) Return() *PriceAggregator_UpdateMarketMap_Call { + _c.Call.Return() + return _c +} + +func (_c *PriceAggregator_UpdateMarketMap_Call) RunAndReturn(run func(types.MarketMap)) *PriceAggregator_UpdateMarketMap_Call { + _c.Call.Return(run) + return _c +} + // NewPriceAggregator creates a new instance of PriceAggregator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewPriceAggregator(t interface { diff --git a/oracle/mocks/mock_oracle.go b/oracle/mocks/mock_oracle.go index 91d3cb8b1..c0240a97b 100644 --- a/oracle/mocks/mock_oracle.go +++ b/oracle/mocks/mock_oracle.go @@ -18,6 +18,14 @@ type Oracle struct { mock.Mock } +type Oracle_Expecter struct { + mock *mock.Mock +} + +func (_m *Oracle) EXPECT() *Oracle_Expecter { + return &Oracle_Expecter{mock: &_m.Mock} +} + // GetLastSyncTime provides a mock function with given fields: func (_m *Oracle) GetLastSyncTime() time.Time { ret := _m.Called() @@ -36,6 +44,33 @@ func (_m *Oracle) GetLastSyncTime() time.Time { return r0 } +// Oracle_GetLastSyncTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastSyncTime' +type Oracle_GetLastSyncTime_Call struct { + *mock.Call +} + +// GetLastSyncTime is a helper method to define mock.On call +func (_e *Oracle_Expecter) GetLastSyncTime() *Oracle_GetLastSyncTime_Call { + return &Oracle_GetLastSyncTime_Call{Call: _e.mock.On("GetLastSyncTime")} +} + +func (_c *Oracle_GetLastSyncTime_Call) Run(run func()) *Oracle_GetLastSyncTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Oracle_GetLastSyncTime_Call) Return(_a0 time.Time) *Oracle_GetLastSyncTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Oracle_GetLastSyncTime_Call) RunAndReturn(run func() time.Time) *Oracle_GetLastSyncTime_Call { + _c.Call.Return(run) + return _c +} + // GetMarketMap provides a mock function with given fields: func (_m *Oracle) GetMarketMap() types.MarketMap { ret := _m.Called() @@ -54,6 +89,33 @@ func (_m *Oracle) GetMarketMap() types.MarketMap { return r0 } +// Oracle_GetMarketMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMarketMap' +type Oracle_GetMarketMap_Call struct { + *mock.Call +} + +// GetMarketMap is a helper method to define mock.On call +func (_e *Oracle_Expecter) GetMarketMap() *Oracle_GetMarketMap_Call { + return &Oracle_GetMarketMap_Call{Call: _e.mock.On("GetMarketMap")} +} + +func (_c *Oracle_GetMarketMap_Call) Run(run func()) *Oracle_GetMarketMap_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Oracle_GetMarketMap_Call) Return(_a0 types.MarketMap) *Oracle_GetMarketMap_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Oracle_GetMarketMap_Call) RunAndReturn(run func() types.MarketMap) *Oracle_GetMarketMap_Call { + _c.Call.Return(run) + return _c +} + // GetPrices provides a mock function with given fields: func (_m *Oracle) GetPrices() map[string]*big.Float { ret := _m.Called() @@ -74,6 +136,33 @@ func (_m *Oracle) GetPrices() map[string]*big.Float { return r0 } +// Oracle_GetPrices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrices' +type Oracle_GetPrices_Call struct { + *mock.Call +} + +// GetPrices is a helper method to define mock.On call +func (_e *Oracle_Expecter) GetPrices() *Oracle_GetPrices_Call { + return &Oracle_GetPrices_Call{Call: _e.mock.On("GetPrices")} +} + +func (_c *Oracle_GetPrices_Call) Run(run func()) *Oracle_GetPrices_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Oracle_GetPrices_Call) Return(_a0 map[string]*big.Float) *Oracle_GetPrices_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Oracle_GetPrices_Call) RunAndReturn(run func() map[string]*big.Float) *Oracle_GetPrices_Call { + _c.Call.Return(run) + return _c +} + // IsRunning provides a mock function with given fields: func (_m *Oracle) IsRunning() bool { ret := _m.Called() @@ -92,6 +181,33 @@ func (_m *Oracle) IsRunning() bool { return r0 } +// Oracle_IsRunning_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsRunning' +type Oracle_IsRunning_Call struct { + *mock.Call +} + +// IsRunning is a helper method to define mock.On call +func (_e *Oracle_Expecter) IsRunning() *Oracle_IsRunning_Call { + return &Oracle_IsRunning_Call{Call: _e.mock.On("IsRunning")} +} + +func (_c *Oracle_IsRunning_Call) Run(run func()) *Oracle_IsRunning_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Oracle_IsRunning_Call) Return(_a0 bool) *Oracle_IsRunning_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Oracle_IsRunning_Call) RunAndReturn(run func() bool) *Oracle_IsRunning_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: ctx func (_m *Oracle) Start(ctx context.Context) error { ret := _m.Called(ctx) @@ -110,11 +226,66 @@ func (_m *Oracle) Start(ctx context.Context) error { return r0 } +// Oracle_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Oracle_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - ctx context.Context +func (_e *Oracle_Expecter) Start(ctx interface{}) *Oracle_Start_Call { + return &Oracle_Start_Call{Call: _e.mock.On("Start", ctx)} +} + +func (_c *Oracle_Start_Call) Run(run func(ctx context.Context)) *Oracle_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Oracle_Start_Call) Return(_a0 error) *Oracle_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Oracle_Start_Call) RunAndReturn(run func(context.Context) error) *Oracle_Start_Call { + _c.Call.Return(run) + return _c +} + // Stop provides a mock function with given fields: func (_m *Oracle) Stop() { _m.Called() } +// Oracle_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type Oracle_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *Oracle_Expecter) Stop() *Oracle_Stop_Call { + return &Oracle_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *Oracle_Stop_Call) Run(run func()) *Oracle_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Oracle_Stop_Call) Return() *Oracle_Stop_Call { + _c.Call.Return() + return _c +} + +func (_c *Oracle_Stop_Call) RunAndReturn(run func()) *Oracle_Stop_Call { + _c.Call.Return(run) + return _c +} + // NewOracle creates a new instance of Oracle. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewOracle(t interface { diff --git a/pkg/math/oracle/aggregator.go b/pkg/math/oracle/aggregator.go index c1816d0d5..dcda58706 100644 --- a/pkg/math/oracle/aggregator.go +++ b/pkg/math/oracle/aggregator.go @@ -5,12 +5,13 @@ import ( "math/big" "sync" + "go.uber.org/zap" + "github.com/skip-mev/connect/v2/oracle" oraclemetrics "github.com/skip-mev/connect/v2/oracle/metrics" "github.com/skip-mev/connect/v2/oracle/types" "github.com/skip-mev/connect/v2/pkg/math" mmtypes "github.com/skip-mev/connect/v2/x/marketmap/types" - "go.uber.org/zap" ) var _ oracle.PriceAggregator = &IndexPriceAggregator{} diff --git a/pkg/math/voteweighted/mocks/mock_cc_validator_store.go b/pkg/math/voteweighted/mocks/mock_cc_validator_store.go index 8c9a8f5fb..70057cb58 100644 --- a/pkg/math/voteweighted/mocks/mock_cc_validator_store.go +++ b/pkg/math/voteweighted/mocks/mock_cc_validator_store.go @@ -14,6 +14,14 @@ type CCValidatorStore struct { mock.Mock } +type CCValidatorStore_Expecter struct { + mock *mock.Mock +} + +func (_m *CCValidatorStore) EXPECT() *CCValidatorStore_Expecter { + return &CCValidatorStore_Expecter{mock: &_m.Mock} +} + // GetAllCCValidator provides a mock function with given fields: ctx func (_m *CCValidatorStore) GetAllCCValidator(ctx types.Context) []consumertypes.CrossChainValidator { ret := _m.Called(ctx) @@ -34,6 +42,34 @@ func (_m *CCValidatorStore) GetAllCCValidator(ctx types.Context) []consumertypes return r0 } +// CCValidatorStore_GetAllCCValidator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllCCValidator' +type CCValidatorStore_GetAllCCValidator_Call struct { + *mock.Call +} + +// GetAllCCValidator is a helper method to define mock.On call +// - ctx types.Context +func (_e *CCValidatorStore_Expecter) GetAllCCValidator(ctx interface{}) *CCValidatorStore_GetAllCCValidator_Call { + return &CCValidatorStore_GetAllCCValidator_Call{Call: _e.mock.On("GetAllCCValidator", ctx)} +} + +func (_c *CCValidatorStore_GetAllCCValidator_Call) Run(run func(ctx types.Context)) *CCValidatorStore_GetAllCCValidator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context)) + }) + return _c +} + +func (_c *CCValidatorStore_GetAllCCValidator_Call) Return(_a0 []consumertypes.CrossChainValidator) *CCValidatorStore_GetAllCCValidator_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CCValidatorStore_GetAllCCValidator_Call) RunAndReturn(run func(types.Context) []consumertypes.CrossChainValidator) *CCValidatorStore_GetAllCCValidator_Call { + _c.Call.Return(run) + return _c +} + // GetCCValidator provides a mock function with given fields: ctx, addr func (_m *CCValidatorStore) GetCCValidator(ctx types.Context, addr []byte) (consumertypes.CrossChainValidator, bool) { ret := _m.Called(ctx, addr) @@ -62,6 +98,35 @@ func (_m *CCValidatorStore) GetCCValidator(ctx types.Context, addr []byte) (cons return r0, r1 } +// CCValidatorStore_GetCCValidator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCCValidator' +type CCValidatorStore_GetCCValidator_Call struct { + *mock.Call +} + +// GetCCValidator is a helper method to define mock.On call +// - ctx types.Context +// - addr []byte +func (_e *CCValidatorStore_Expecter) GetCCValidator(ctx interface{}, addr interface{}) *CCValidatorStore_GetCCValidator_Call { + return &CCValidatorStore_GetCCValidator_Call{Call: _e.mock.On("GetCCValidator", ctx, addr)} +} + +func (_c *CCValidatorStore_GetCCValidator_Call) Run(run func(ctx types.Context, addr []byte)) *CCValidatorStore_GetCCValidator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].([]byte)) + }) + return _c +} + +func (_c *CCValidatorStore_GetCCValidator_Call) Return(_a0 consumertypes.CrossChainValidator, _a1 bool) *CCValidatorStore_GetCCValidator_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CCValidatorStore_GetCCValidator_Call) RunAndReturn(run func(types.Context, []byte) (consumertypes.CrossChainValidator, bool)) *CCValidatorStore_GetCCValidator_Call { + _c.Call.Return(run) + return _c +} + // NewCCValidatorStore creates a new instance of CCValidatorStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCCValidatorStore(t interface { diff --git a/pkg/math/voteweighted/mocks/mock_validator.go b/pkg/math/voteweighted/mocks/mock_validator.go index 3a896d7e0..be1e2389f 100644 --- a/pkg/math/voteweighted/mocks/mock_validator.go +++ b/pkg/math/voteweighted/mocks/mock_validator.go @@ -18,6 +18,14 @@ type ValidatorI struct { mock.Mock } +type ValidatorI_Expecter struct { + mock *mock.Mock +} + +func (_m *ValidatorI) EXPECT() *ValidatorI_Expecter { + return &ValidatorI_Expecter{mock: &_m.Mock} +} + // ConsPubKey provides a mock function with given fields: func (_m *ValidatorI) ConsPubKey() (types.PubKey, error) { ret := _m.Called() @@ -48,6 +56,33 @@ func (_m *ValidatorI) ConsPubKey() (types.PubKey, error) { return r0, r1 } +// ValidatorI_ConsPubKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConsPubKey' +type ValidatorI_ConsPubKey_Call struct { + *mock.Call +} + +// ConsPubKey is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) ConsPubKey() *ValidatorI_ConsPubKey_Call { + return &ValidatorI_ConsPubKey_Call{Call: _e.mock.On("ConsPubKey")} +} + +func (_c *ValidatorI_ConsPubKey_Call) Run(run func()) *ValidatorI_ConsPubKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_ConsPubKey_Call) Return(_a0 types.PubKey, _a1 error) *ValidatorI_ConsPubKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorI_ConsPubKey_Call) RunAndReturn(run func() (types.PubKey, error)) *ValidatorI_ConsPubKey_Call { + _c.Call.Return(run) + return _c +} + // GetBondedTokens provides a mock function with given fields: func (_m *ValidatorI) GetBondedTokens() math.Int { ret := _m.Called() @@ -66,6 +101,33 @@ func (_m *ValidatorI) GetBondedTokens() math.Int { return r0 } +// ValidatorI_GetBondedTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBondedTokens' +type ValidatorI_GetBondedTokens_Call struct { + *mock.Call +} + +// GetBondedTokens is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetBondedTokens() *ValidatorI_GetBondedTokens_Call { + return &ValidatorI_GetBondedTokens_Call{Call: _e.mock.On("GetBondedTokens")} +} + +func (_c *ValidatorI_GetBondedTokens_Call) Run(run func()) *ValidatorI_GetBondedTokens_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetBondedTokens_Call) Return(_a0 math.Int) *ValidatorI_GetBondedTokens_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetBondedTokens_Call) RunAndReturn(run func() math.Int) *ValidatorI_GetBondedTokens_Call { + _c.Call.Return(run) + return _c +} + // GetCommission provides a mock function with given fields: func (_m *ValidatorI) GetCommission() math.LegacyDec { ret := _m.Called() @@ -84,6 +146,33 @@ func (_m *ValidatorI) GetCommission() math.LegacyDec { return r0 } +// ValidatorI_GetCommission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCommission' +type ValidatorI_GetCommission_Call struct { + *mock.Call +} + +// GetCommission is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetCommission() *ValidatorI_GetCommission_Call { + return &ValidatorI_GetCommission_Call{Call: _e.mock.On("GetCommission")} +} + +func (_c *ValidatorI_GetCommission_Call) Run(run func()) *ValidatorI_GetCommission_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetCommission_Call) Return(_a0 math.LegacyDec) *ValidatorI_GetCommission_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetCommission_Call) RunAndReturn(run func() math.LegacyDec) *ValidatorI_GetCommission_Call { + _c.Call.Return(run) + return _c +} + // GetConsAddr provides a mock function with given fields: func (_m *ValidatorI) GetConsAddr() ([]byte, error) { ret := _m.Called() @@ -114,6 +203,33 @@ func (_m *ValidatorI) GetConsAddr() ([]byte, error) { return r0, r1 } +// ValidatorI_GetConsAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConsAddr' +type ValidatorI_GetConsAddr_Call struct { + *mock.Call +} + +// GetConsAddr is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetConsAddr() *ValidatorI_GetConsAddr_Call { + return &ValidatorI_GetConsAddr_Call{Call: _e.mock.On("GetConsAddr")} +} + +func (_c *ValidatorI_GetConsAddr_Call) Run(run func()) *ValidatorI_GetConsAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetConsAddr_Call) Return(_a0 []byte, _a1 error) *ValidatorI_GetConsAddr_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorI_GetConsAddr_Call) RunAndReturn(run func() ([]byte, error)) *ValidatorI_GetConsAddr_Call { + _c.Call.Return(run) + return _c +} + // GetConsensusPower provides a mock function with given fields: _a0 func (_m *ValidatorI) GetConsensusPower(_a0 math.Int) int64 { ret := _m.Called(_a0) @@ -132,6 +248,34 @@ func (_m *ValidatorI) GetConsensusPower(_a0 math.Int) int64 { return r0 } +// ValidatorI_GetConsensusPower_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConsensusPower' +type ValidatorI_GetConsensusPower_Call struct { + *mock.Call +} + +// GetConsensusPower is a helper method to define mock.On call +// - _a0 math.Int +func (_e *ValidatorI_Expecter) GetConsensusPower(_a0 interface{}) *ValidatorI_GetConsensusPower_Call { + return &ValidatorI_GetConsensusPower_Call{Call: _e.mock.On("GetConsensusPower", _a0)} +} + +func (_c *ValidatorI_GetConsensusPower_Call) Run(run func(_a0 math.Int)) *ValidatorI_GetConsensusPower_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.Int)) + }) + return _c +} + +func (_c *ValidatorI_GetConsensusPower_Call) Return(_a0 int64) *ValidatorI_GetConsensusPower_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetConsensusPower_Call) RunAndReturn(run func(math.Int) int64) *ValidatorI_GetConsensusPower_Call { + _c.Call.Return(run) + return _c +} + // GetDelegatorShares provides a mock function with given fields: func (_m *ValidatorI) GetDelegatorShares() math.LegacyDec { ret := _m.Called() @@ -150,6 +294,33 @@ func (_m *ValidatorI) GetDelegatorShares() math.LegacyDec { return r0 } +// ValidatorI_GetDelegatorShares_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDelegatorShares' +type ValidatorI_GetDelegatorShares_Call struct { + *mock.Call +} + +// GetDelegatorShares is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetDelegatorShares() *ValidatorI_GetDelegatorShares_Call { + return &ValidatorI_GetDelegatorShares_Call{Call: _e.mock.On("GetDelegatorShares")} +} + +func (_c *ValidatorI_GetDelegatorShares_Call) Run(run func()) *ValidatorI_GetDelegatorShares_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetDelegatorShares_Call) Return(_a0 math.LegacyDec) *ValidatorI_GetDelegatorShares_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetDelegatorShares_Call) RunAndReturn(run func() math.LegacyDec) *ValidatorI_GetDelegatorShares_Call { + _c.Call.Return(run) + return _c +} + // GetMinSelfDelegation provides a mock function with given fields: func (_m *ValidatorI) GetMinSelfDelegation() math.Int { ret := _m.Called() @@ -168,6 +339,33 @@ func (_m *ValidatorI) GetMinSelfDelegation() math.Int { return r0 } +// ValidatorI_GetMinSelfDelegation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMinSelfDelegation' +type ValidatorI_GetMinSelfDelegation_Call struct { + *mock.Call +} + +// GetMinSelfDelegation is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetMinSelfDelegation() *ValidatorI_GetMinSelfDelegation_Call { + return &ValidatorI_GetMinSelfDelegation_Call{Call: _e.mock.On("GetMinSelfDelegation")} +} + +func (_c *ValidatorI_GetMinSelfDelegation_Call) Run(run func()) *ValidatorI_GetMinSelfDelegation_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetMinSelfDelegation_Call) Return(_a0 math.Int) *ValidatorI_GetMinSelfDelegation_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetMinSelfDelegation_Call) RunAndReturn(run func() math.Int) *ValidatorI_GetMinSelfDelegation_Call { + _c.Call.Return(run) + return _c +} + // GetMoniker provides a mock function with given fields: func (_m *ValidatorI) GetMoniker() string { ret := _m.Called() @@ -186,6 +384,33 @@ func (_m *ValidatorI) GetMoniker() string { return r0 } +// ValidatorI_GetMoniker_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMoniker' +type ValidatorI_GetMoniker_Call struct { + *mock.Call +} + +// GetMoniker is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetMoniker() *ValidatorI_GetMoniker_Call { + return &ValidatorI_GetMoniker_Call{Call: _e.mock.On("GetMoniker")} +} + +func (_c *ValidatorI_GetMoniker_Call) Run(run func()) *ValidatorI_GetMoniker_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetMoniker_Call) Return(_a0 string) *ValidatorI_GetMoniker_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetMoniker_Call) RunAndReturn(run func() string) *ValidatorI_GetMoniker_Call { + _c.Call.Return(run) + return _c +} + // GetOperator provides a mock function with given fields: func (_m *ValidatorI) GetOperator() string { ret := _m.Called() @@ -204,6 +429,33 @@ func (_m *ValidatorI) GetOperator() string { return r0 } +// ValidatorI_GetOperator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOperator' +type ValidatorI_GetOperator_Call struct { + *mock.Call +} + +// GetOperator is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetOperator() *ValidatorI_GetOperator_Call { + return &ValidatorI_GetOperator_Call{Call: _e.mock.On("GetOperator")} +} + +func (_c *ValidatorI_GetOperator_Call) Run(run func()) *ValidatorI_GetOperator_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetOperator_Call) Return(_a0 string) *ValidatorI_GetOperator_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetOperator_Call) RunAndReturn(run func() string) *ValidatorI_GetOperator_Call { + _c.Call.Return(run) + return _c +} + // GetStatus provides a mock function with given fields: func (_m *ValidatorI) GetStatus() stakingtypes.BondStatus { ret := _m.Called() @@ -222,6 +474,33 @@ func (_m *ValidatorI) GetStatus() stakingtypes.BondStatus { return r0 } +// ValidatorI_GetStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatus' +type ValidatorI_GetStatus_Call struct { + *mock.Call +} + +// GetStatus is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetStatus() *ValidatorI_GetStatus_Call { + return &ValidatorI_GetStatus_Call{Call: _e.mock.On("GetStatus")} +} + +func (_c *ValidatorI_GetStatus_Call) Run(run func()) *ValidatorI_GetStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetStatus_Call) Return(_a0 stakingtypes.BondStatus) *ValidatorI_GetStatus_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetStatus_Call) RunAndReturn(run func() stakingtypes.BondStatus) *ValidatorI_GetStatus_Call { + _c.Call.Return(run) + return _c +} + // GetTokens provides a mock function with given fields: func (_m *ValidatorI) GetTokens() math.Int { ret := _m.Called() @@ -240,6 +519,33 @@ func (_m *ValidatorI) GetTokens() math.Int { return r0 } +// ValidatorI_GetTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTokens' +type ValidatorI_GetTokens_Call struct { + *mock.Call +} + +// GetTokens is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) GetTokens() *ValidatorI_GetTokens_Call { + return &ValidatorI_GetTokens_Call{Call: _e.mock.On("GetTokens")} +} + +func (_c *ValidatorI_GetTokens_Call) Run(run func()) *ValidatorI_GetTokens_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_GetTokens_Call) Return(_a0 math.Int) *ValidatorI_GetTokens_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_GetTokens_Call) RunAndReturn(run func() math.Int) *ValidatorI_GetTokens_Call { + _c.Call.Return(run) + return _c +} + // IsBonded provides a mock function with given fields: func (_m *ValidatorI) IsBonded() bool { ret := _m.Called() @@ -258,6 +564,33 @@ func (_m *ValidatorI) IsBonded() bool { return r0 } +// ValidatorI_IsBonded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsBonded' +type ValidatorI_IsBonded_Call struct { + *mock.Call +} + +// IsBonded is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) IsBonded() *ValidatorI_IsBonded_Call { + return &ValidatorI_IsBonded_Call{Call: _e.mock.On("IsBonded")} +} + +func (_c *ValidatorI_IsBonded_Call) Run(run func()) *ValidatorI_IsBonded_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_IsBonded_Call) Return(_a0 bool) *ValidatorI_IsBonded_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_IsBonded_Call) RunAndReturn(run func() bool) *ValidatorI_IsBonded_Call { + _c.Call.Return(run) + return _c +} + // IsJailed provides a mock function with given fields: func (_m *ValidatorI) IsJailed() bool { ret := _m.Called() @@ -276,6 +609,33 @@ func (_m *ValidatorI) IsJailed() bool { return r0 } +// ValidatorI_IsJailed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsJailed' +type ValidatorI_IsJailed_Call struct { + *mock.Call +} + +// IsJailed is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) IsJailed() *ValidatorI_IsJailed_Call { + return &ValidatorI_IsJailed_Call{Call: _e.mock.On("IsJailed")} +} + +func (_c *ValidatorI_IsJailed_Call) Run(run func()) *ValidatorI_IsJailed_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_IsJailed_Call) Return(_a0 bool) *ValidatorI_IsJailed_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_IsJailed_Call) RunAndReturn(run func() bool) *ValidatorI_IsJailed_Call { + _c.Call.Return(run) + return _c +} + // IsUnbonded provides a mock function with given fields: func (_m *ValidatorI) IsUnbonded() bool { ret := _m.Called() @@ -294,6 +654,33 @@ func (_m *ValidatorI) IsUnbonded() bool { return r0 } +// ValidatorI_IsUnbonded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUnbonded' +type ValidatorI_IsUnbonded_Call struct { + *mock.Call +} + +// IsUnbonded is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) IsUnbonded() *ValidatorI_IsUnbonded_Call { + return &ValidatorI_IsUnbonded_Call{Call: _e.mock.On("IsUnbonded")} +} + +func (_c *ValidatorI_IsUnbonded_Call) Run(run func()) *ValidatorI_IsUnbonded_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_IsUnbonded_Call) Return(_a0 bool) *ValidatorI_IsUnbonded_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_IsUnbonded_Call) RunAndReturn(run func() bool) *ValidatorI_IsUnbonded_Call { + _c.Call.Return(run) + return _c +} + // IsUnbonding provides a mock function with given fields: func (_m *ValidatorI) IsUnbonding() bool { ret := _m.Called() @@ -312,6 +699,33 @@ func (_m *ValidatorI) IsUnbonding() bool { return r0 } +// ValidatorI_IsUnbonding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsUnbonding' +type ValidatorI_IsUnbonding_Call struct { + *mock.Call +} + +// IsUnbonding is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) IsUnbonding() *ValidatorI_IsUnbonding_Call { + return &ValidatorI_IsUnbonding_Call{Call: _e.mock.On("IsUnbonding")} +} + +func (_c *ValidatorI_IsUnbonding_Call) Run(run func()) *ValidatorI_IsUnbonding_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_IsUnbonding_Call) Return(_a0 bool) *ValidatorI_IsUnbonding_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_IsUnbonding_Call) RunAndReturn(run func() bool) *ValidatorI_IsUnbonding_Call { + _c.Call.Return(run) + return _c +} + // SharesFromTokens provides a mock function with given fields: amt func (_m *ValidatorI) SharesFromTokens(amt math.Int) (math.LegacyDec, error) { ret := _m.Called(amt) @@ -340,6 +754,34 @@ func (_m *ValidatorI) SharesFromTokens(amt math.Int) (math.LegacyDec, error) { return r0, r1 } +// ValidatorI_SharesFromTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SharesFromTokens' +type ValidatorI_SharesFromTokens_Call struct { + *mock.Call +} + +// SharesFromTokens is a helper method to define mock.On call +// - amt math.Int +func (_e *ValidatorI_Expecter) SharesFromTokens(amt interface{}) *ValidatorI_SharesFromTokens_Call { + return &ValidatorI_SharesFromTokens_Call{Call: _e.mock.On("SharesFromTokens", amt)} +} + +func (_c *ValidatorI_SharesFromTokens_Call) Run(run func(amt math.Int)) *ValidatorI_SharesFromTokens_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.Int)) + }) + return _c +} + +func (_c *ValidatorI_SharesFromTokens_Call) Return(_a0 math.LegacyDec, _a1 error) *ValidatorI_SharesFromTokens_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorI_SharesFromTokens_Call) RunAndReturn(run func(math.Int) (math.LegacyDec, error)) *ValidatorI_SharesFromTokens_Call { + _c.Call.Return(run) + return _c +} + // SharesFromTokensTruncated provides a mock function with given fields: amt func (_m *ValidatorI) SharesFromTokensTruncated(amt math.Int) (math.LegacyDec, error) { ret := _m.Called(amt) @@ -368,6 +810,34 @@ func (_m *ValidatorI) SharesFromTokensTruncated(amt math.Int) (math.LegacyDec, e return r0, r1 } +// ValidatorI_SharesFromTokensTruncated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SharesFromTokensTruncated' +type ValidatorI_SharesFromTokensTruncated_Call struct { + *mock.Call +} + +// SharesFromTokensTruncated is a helper method to define mock.On call +// - amt math.Int +func (_e *ValidatorI_Expecter) SharesFromTokensTruncated(amt interface{}) *ValidatorI_SharesFromTokensTruncated_Call { + return &ValidatorI_SharesFromTokensTruncated_Call{Call: _e.mock.On("SharesFromTokensTruncated", amt)} +} + +func (_c *ValidatorI_SharesFromTokensTruncated_Call) Run(run func(amt math.Int)) *ValidatorI_SharesFromTokensTruncated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.Int)) + }) + return _c +} + +func (_c *ValidatorI_SharesFromTokensTruncated_Call) Return(_a0 math.LegacyDec, _a1 error) *ValidatorI_SharesFromTokensTruncated_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorI_SharesFromTokensTruncated_Call) RunAndReturn(run func(math.Int) (math.LegacyDec, error)) *ValidatorI_SharesFromTokensTruncated_Call { + _c.Call.Return(run) + return _c +} + // TmConsPublicKey provides a mock function with given fields: func (_m *ValidatorI) TmConsPublicKey() (crypto.PublicKey, error) { ret := _m.Called() @@ -396,6 +866,33 @@ func (_m *ValidatorI) TmConsPublicKey() (crypto.PublicKey, error) { return r0, r1 } +// ValidatorI_TmConsPublicKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TmConsPublicKey' +type ValidatorI_TmConsPublicKey_Call struct { + *mock.Call +} + +// TmConsPublicKey is a helper method to define mock.On call +func (_e *ValidatorI_Expecter) TmConsPublicKey() *ValidatorI_TmConsPublicKey_Call { + return &ValidatorI_TmConsPublicKey_Call{Call: _e.mock.On("TmConsPublicKey")} +} + +func (_c *ValidatorI_TmConsPublicKey_Call) Run(run func()) *ValidatorI_TmConsPublicKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ValidatorI_TmConsPublicKey_Call) Return(_a0 crypto.PublicKey, _a1 error) *ValidatorI_TmConsPublicKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorI_TmConsPublicKey_Call) RunAndReturn(run func() (crypto.PublicKey, error)) *ValidatorI_TmConsPublicKey_Call { + _c.Call.Return(run) + return _c +} + // TokensFromShares provides a mock function with given fields: _a0 func (_m *ValidatorI) TokensFromShares(_a0 math.LegacyDec) math.LegacyDec { ret := _m.Called(_a0) @@ -414,6 +911,34 @@ func (_m *ValidatorI) TokensFromShares(_a0 math.LegacyDec) math.LegacyDec { return r0 } +// ValidatorI_TokensFromShares_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TokensFromShares' +type ValidatorI_TokensFromShares_Call struct { + *mock.Call +} + +// TokensFromShares is a helper method to define mock.On call +// - _a0 math.LegacyDec +func (_e *ValidatorI_Expecter) TokensFromShares(_a0 interface{}) *ValidatorI_TokensFromShares_Call { + return &ValidatorI_TokensFromShares_Call{Call: _e.mock.On("TokensFromShares", _a0)} +} + +func (_c *ValidatorI_TokensFromShares_Call) Run(run func(_a0 math.LegacyDec)) *ValidatorI_TokensFromShares_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.LegacyDec)) + }) + return _c +} + +func (_c *ValidatorI_TokensFromShares_Call) Return(_a0 math.LegacyDec) *ValidatorI_TokensFromShares_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_TokensFromShares_Call) RunAndReturn(run func(math.LegacyDec) math.LegacyDec) *ValidatorI_TokensFromShares_Call { + _c.Call.Return(run) + return _c +} + // TokensFromSharesRoundUp provides a mock function with given fields: _a0 func (_m *ValidatorI) TokensFromSharesRoundUp(_a0 math.LegacyDec) math.LegacyDec { ret := _m.Called(_a0) @@ -432,6 +957,34 @@ func (_m *ValidatorI) TokensFromSharesRoundUp(_a0 math.LegacyDec) math.LegacyDec return r0 } +// ValidatorI_TokensFromSharesRoundUp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TokensFromSharesRoundUp' +type ValidatorI_TokensFromSharesRoundUp_Call struct { + *mock.Call +} + +// TokensFromSharesRoundUp is a helper method to define mock.On call +// - _a0 math.LegacyDec +func (_e *ValidatorI_Expecter) TokensFromSharesRoundUp(_a0 interface{}) *ValidatorI_TokensFromSharesRoundUp_Call { + return &ValidatorI_TokensFromSharesRoundUp_Call{Call: _e.mock.On("TokensFromSharesRoundUp", _a0)} +} + +func (_c *ValidatorI_TokensFromSharesRoundUp_Call) Run(run func(_a0 math.LegacyDec)) *ValidatorI_TokensFromSharesRoundUp_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.LegacyDec)) + }) + return _c +} + +func (_c *ValidatorI_TokensFromSharesRoundUp_Call) Return(_a0 math.LegacyDec) *ValidatorI_TokensFromSharesRoundUp_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_TokensFromSharesRoundUp_Call) RunAndReturn(run func(math.LegacyDec) math.LegacyDec) *ValidatorI_TokensFromSharesRoundUp_Call { + _c.Call.Return(run) + return _c +} + // TokensFromSharesTruncated provides a mock function with given fields: _a0 func (_m *ValidatorI) TokensFromSharesTruncated(_a0 math.LegacyDec) math.LegacyDec { ret := _m.Called(_a0) @@ -450,6 +1003,34 @@ func (_m *ValidatorI) TokensFromSharesTruncated(_a0 math.LegacyDec) math.LegacyD return r0 } +// ValidatorI_TokensFromSharesTruncated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TokensFromSharesTruncated' +type ValidatorI_TokensFromSharesTruncated_Call struct { + *mock.Call +} + +// TokensFromSharesTruncated is a helper method to define mock.On call +// - _a0 math.LegacyDec +func (_e *ValidatorI_Expecter) TokensFromSharesTruncated(_a0 interface{}) *ValidatorI_TokensFromSharesTruncated_Call { + return &ValidatorI_TokensFromSharesTruncated_Call{Call: _e.mock.On("TokensFromSharesTruncated", _a0)} +} + +func (_c *ValidatorI_TokensFromSharesTruncated_Call) Run(run func(_a0 math.LegacyDec)) *ValidatorI_TokensFromSharesTruncated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(math.LegacyDec)) + }) + return _c +} + +func (_c *ValidatorI_TokensFromSharesTruncated_Call) Return(_a0 math.LegacyDec) *ValidatorI_TokensFromSharesTruncated_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ValidatorI_TokensFromSharesTruncated_Call) RunAndReturn(run func(math.LegacyDec) math.LegacyDec) *ValidatorI_TokensFromSharesTruncated_Call { + _c.Call.Return(run) + return _c +} + // NewValidatorI creates a new instance of ValidatorI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewValidatorI(t interface { diff --git a/pkg/math/voteweighted/mocks/mock_validator_store.go b/pkg/math/voteweighted/mocks/mock_validator_store.go index bb302b486..cc4b98d78 100644 --- a/pkg/math/voteweighted/mocks/mock_validator_store.go +++ b/pkg/math/voteweighted/mocks/mock_validator_store.go @@ -19,6 +19,14 @@ type ValidatorStore struct { mock.Mock } +type ValidatorStore_Expecter struct { + mock *mock.Mock +} + +func (_m *ValidatorStore) EXPECT() *ValidatorStore_Expecter { + return &ValidatorStore_Expecter{mock: &_m.Mock} +} + // TotalBondedTokens provides a mock function with given fields: ctx func (_m *ValidatorStore) TotalBondedTokens(ctx context.Context) (math.Int, error) { ret := _m.Called(ctx) @@ -47,6 +55,34 @@ func (_m *ValidatorStore) TotalBondedTokens(ctx context.Context) (math.Int, erro return r0, r1 } +// ValidatorStore_TotalBondedTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TotalBondedTokens' +type ValidatorStore_TotalBondedTokens_Call struct { + *mock.Call +} + +// TotalBondedTokens is a helper method to define mock.On call +// - ctx context.Context +func (_e *ValidatorStore_Expecter) TotalBondedTokens(ctx interface{}) *ValidatorStore_TotalBondedTokens_Call { + return &ValidatorStore_TotalBondedTokens_Call{Call: _e.mock.On("TotalBondedTokens", ctx)} +} + +func (_c *ValidatorStore_TotalBondedTokens_Call) Run(run func(ctx context.Context)) *ValidatorStore_TotalBondedTokens_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ValidatorStore_TotalBondedTokens_Call) Return(_a0 math.Int, _a1 error) *ValidatorStore_TotalBondedTokens_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorStore_TotalBondedTokens_Call) RunAndReturn(run func(context.Context) (math.Int, error)) *ValidatorStore_TotalBondedTokens_Call { + _c.Call.Return(run) + return _c +} + // ValidatorByConsAddr provides a mock function with given fields: ctx, addr func (_m *ValidatorStore) ValidatorByConsAddr(ctx context.Context, addr types.ConsAddress) (stakingtypes.ValidatorI, error) { ret := _m.Called(ctx, addr) @@ -77,6 +113,35 @@ func (_m *ValidatorStore) ValidatorByConsAddr(ctx context.Context, addr types.Co return r0, r1 } +// ValidatorStore_ValidatorByConsAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidatorByConsAddr' +type ValidatorStore_ValidatorByConsAddr_Call struct { + *mock.Call +} + +// ValidatorByConsAddr is a helper method to define mock.On call +// - ctx context.Context +// - addr types.ConsAddress +func (_e *ValidatorStore_Expecter) ValidatorByConsAddr(ctx interface{}, addr interface{}) *ValidatorStore_ValidatorByConsAddr_Call { + return &ValidatorStore_ValidatorByConsAddr_Call{Call: _e.mock.On("ValidatorByConsAddr", ctx, addr)} +} + +func (_c *ValidatorStore_ValidatorByConsAddr_Call) Run(run func(ctx context.Context, addr types.ConsAddress)) *ValidatorStore_ValidatorByConsAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(types.ConsAddress)) + }) + return _c +} + +func (_c *ValidatorStore_ValidatorByConsAddr_Call) Return(_a0 stakingtypes.ValidatorI, _a1 error) *ValidatorStore_ValidatorByConsAddr_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ValidatorStore_ValidatorByConsAddr_Call) RunAndReturn(run func(context.Context, types.ConsAddress) (stakingtypes.ValidatorI, error)) *ValidatorStore_ValidatorByConsAddr_Call { + _c.Call.Return(run) + return _c +} + // NewValidatorStore creates a new instance of ValidatorStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewValidatorStore(t interface { diff --git a/providers/apis/defi/ethmulticlient/mocks/EVMClient.go b/providers/apis/defi/ethmulticlient/mocks/EVMClient.go index d425dadec..18ed5e19a 100644 --- a/providers/apis/defi/ethmulticlient/mocks/EVMClient.go +++ b/providers/apis/defi/ethmulticlient/mocks/EVMClient.go @@ -15,6 +15,14 @@ type EVMClient struct { mock.Mock } +type EVMClient_Expecter struct { + mock *mock.Mock +} + +func (_m *EVMClient) EXPECT() *EVMClient_Expecter { + return &EVMClient_Expecter{mock: &_m.Mock} +} + // BatchCallContext provides a mock function with given fields: ctx, calls func (_m *EVMClient) BatchCallContext(ctx context.Context, calls []rpc.BatchElem) error { ret := _m.Called(ctx, calls) @@ -33,6 +41,35 @@ func (_m *EVMClient) BatchCallContext(ctx context.Context, calls []rpc.BatchElem return r0 } +// EVMClient_BatchCallContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchCallContext' +type EVMClient_BatchCallContext_Call struct { + *mock.Call +} + +// BatchCallContext is a helper method to define mock.On call +// - ctx context.Context +// - calls []rpc.BatchElem +func (_e *EVMClient_Expecter) BatchCallContext(ctx interface{}, calls interface{}) *EVMClient_BatchCallContext_Call { + return &EVMClient_BatchCallContext_Call{Call: _e.mock.On("BatchCallContext", ctx, calls)} +} + +func (_c *EVMClient_BatchCallContext_Call) Run(run func(ctx context.Context, calls []rpc.BatchElem)) *EVMClient_BatchCallContext_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]rpc.BatchElem)) + }) + return _c +} + +func (_c *EVMClient_BatchCallContext_Call) Return(_a0 error) *EVMClient_BatchCallContext_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EVMClient_BatchCallContext_Call) RunAndReturn(run func(context.Context, []rpc.BatchElem) error) *EVMClient_BatchCallContext_Call { + _c.Call.Return(run) + return _c +} + // NewEVMClient creates a new instance of EVMClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewEVMClient(t interface { diff --git a/providers/apis/defi/osmosis/mocks/client.go b/providers/apis/defi/osmosis/mocks/client.go index 7ee723aaa..9333e36bd 100644 --- a/providers/apis/defi/osmosis/mocks/client.go +++ b/providers/apis/defi/osmosis/mocks/client.go @@ -15,6 +15,14 @@ type Client struct { mock.Mock } +type Client_Expecter struct { + mock *mock.Mock +} + +func (_m *Client) EXPECT() *Client_Expecter { + return &Client_Expecter{mock: &_m.Mock} +} + // SpotPrice provides a mock function with given fields: ctx, poolID, baseAsset, quoteAsset func (_m *Client) SpotPrice(ctx context.Context, poolID uint64, baseAsset string, quoteAsset string) (osmosis.WrappedSpotPriceResponse, error) { ret := _m.Called(ctx, poolID, baseAsset, quoteAsset) @@ -43,6 +51,37 @@ func (_m *Client) SpotPrice(ctx context.Context, poolID uint64, baseAsset string return r0, r1 } +// Client_SpotPrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpotPrice' +type Client_SpotPrice_Call struct { + *mock.Call +} + +// SpotPrice is a helper method to define mock.On call +// - ctx context.Context +// - poolID uint64 +// - baseAsset string +// - quoteAsset string +func (_e *Client_Expecter) SpotPrice(ctx interface{}, poolID interface{}, baseAsset interface{}, quoteAsset interface{}) *Client_SpotPrice_Call { + return &Client_SpotPrice_Call{Call: _e.mock.On("SpotPrice", ctx, poolID, baseAsset, quoteAsset)} +} + +func (_c *Client_SpotPrice_Call) Run(run func(ctx context.Context, poolID uint64, baseAsset string, quoteAsset string)) *Client_SpotPrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64), args[2].(string), args[3].(string)) + }) + return _c +} + +func (_c *Client_SpotPrice_Call) Return(_a0 osmosis.WrappedSpotPriceResponse, _a1 error) *Client_SpotPrice_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_SpotPrice_Call) RunAndReturn(run func(context.Context, uint64, string, string) (osmosis.WrappedSpotPriceResponse, error)) *Client_SpotPrice_Call { + _c.Call.Return(run) + return _c +} + // NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewClient(t interface { diff --git a/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go b/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go index 29f384a27..70b490544 100644 --- a/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go +++ b/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go @@ -17,6 +17,14 @@ type SolanaJSONRPCClient struct { mock.Mock } +type SolanaJSONRPCClient_Expecter struct { + mock *mock.Mock +} + +func (_m *SolanaJSONRPCClient) EXPECT() *SolanaJSONRPCClient_Expecter { + return &SolanaJSONRPCClient_Expecter{mock: &_m.Mock} +} + // GetMultipleAccountsWithOpts provides a mock function with given fields: ctx, accounts, opts func (_m *SolanaJSONRPCClient) GetMultipleAccountsWithOpts(ctx context.Context, accounts []solana.PublicKey, opts *rpc.GetMultipleAccountsOpts) (*rpc.GetMultipleAccountsResult, error) { ret := _m.Called(ctx, accounts, opts) @@ -47,6 +55,36 @@ func (_m *SolanaJSONRPCClient) GetMultipleAccountsWithOpts(ctx context.Context, return r0, r1 } +// SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMultipleAccountsWithOpts' +type SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call struct { + *mock.Call +} + +// GetMultipleAccountsWithOpts is a helper method to define mock.On call +// - ctx context.Context +// - accounts []solana.PublicKey +// - opts *rpc.GetMultipleAccountsOpts +func (_e *SolanaJSONRPCClient_Expecter) GetMultipleAccountsWithOpts(ctx interface{}, accounts interface{}, opts interface{}) *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call { + return &SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call{Call: _e.mock.On("GetMultipleAccountsWithOpts", ctx, accounts, opts)} +} + +func (_c *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call) Run(run func(ctx context.Context, accounts []solana.PublicKey, opts *rpc.GetMultipleAccountsOpts)) *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]solana.PublicKey), args[2].(*rpc.GetMultipleAccountsOpts)) + }) + return _c +} + +func (_c *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call) Return(out *rpc.GetMultipleAccountsResult, err error) *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call { + _c.Call.Return(out, err) + return _c +} + +func (_c *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call) RunAndReturn(run func(context.Context, []solana.PublicKey, *rpc.GetMultipleAccountsOpts) (*rpc.GetMultipleAccountsResult, error)) *SolanaJSONRPCClient_GetMultipleAccountsWithOpts_Call { + _c.Call.Return(run) + return _c +} + // NewSolanaJSONRPCClient creates a new instance of SolanaJSONRPCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSolanaJSONRPCClient(t interface { diff --git a/providers/base/api/handlers/mocks/api_data_handler.go b/providers/base/api/handlers/mocks/api_data_handler.go index 9c73313f4..43f8902b9 100644 --- a/providers/base/api/handlers/mocks/api_data_handler.go +++ b/providers/base/api/handlers/mocks/api_data_handler.go @@ -15,6 +15,14 @@ type APIDataHandler[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type APIDataHandler_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *APIDataHandler[K, V]) EXPECT() *APIDataHandler_Expecter[K, V] { + return &APIDataHandler_Expecter[K, V]{mock: &_m.Mock} +} + // CreateURL provides a mock function with given fields: ids func (_m *APIDataHandler[K, V]) CreateURL(ids []K) (string, error) { ret := _m.Called(ids) @@ -43,6 +51,34 @@ func (_m *APIDataHandler[K, V]) CreateURL(ids []K) (string, error) { return r0, r1 } +// APIDataHandler_CreateURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateURL' +type APIDataHandler_CreateURL_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// CreateURL is a helper method to define mock.On call +// - ids []K +func (_e *APIDataHandler_Expecter[K, V]) CreateURL(ids interface{}) *APIDataHandler_CreateURL_Call[K, V] { + return &APIDataHandler_CreateURL_Call[K, V]{Call: _e.mock.On("CreateURL", ids)} +} + +func (_c *APIDataHandler_CreateURL_Call[K, V]) Run(run func(ids []K)) *APIDataHandler_CreateURL_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]K)) + }) + return _c +} + +func (_c *APIDataHandler_CreateURL_Call[K, V]) Return(_a0 string, _a1 error) *APIDataHandler_CreateURL_Call[K, V] { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *APIDataHandler_CreateURL_Call[K, V]) RunAndReturn(run func([]K) (string, error)) *APIDataHandler_CreateURL_Call[K, V] { + _c.Call.Return(run) + return _c +} + // ParseResponse provides a mock function with given fields: ids, response func (_m *APIDataHandler[K, V]) ParseResponse(ids []K, response *http.Response) types.GetResponse[K, V] { ret := _m.Called(ids, response) @@ -61,6 +97,35 @@ func (_m *APIDataHandler[K, V]) ParseResponse(ids []K, response *http.Response) return r0 } +// APIDataHandler_ParseResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseResponse' +type APIDataHandler_ParseResponse_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// ParseResponse is a helper method to define mock.On call +// - ids []K +// - response *http.Response +func (_e *APIDataHandler_Expecter[K, V]) ParseResponse(ids interface{}, response interface{}) *APIDataHandler_ParseResponse_Call[K, V] { + return &APIDataHandler_ParseResponse_Call[K, V]{Call: _e.mock.On("ParseResponse", ids, response)} +} + +func (_c *APIDataHandler_ParseResponse_Call[K, V]) Run(run func(ids []K, response *http.Response)) *APIDataHandler_ParseResponse_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]K), args[1].(*http.Response)) + }) + return _c +} + +func (_c *APIDataHandler_ParseResponse_Call[K, V]) Return(_a0 types.GetResponse[K, V]) *APIDataHandler_ParseResponse_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *APIDataHandler_ParseResponse_Call[K, V]) RunAndReturn(run func([]K, *http.Response) types.GetResponse[K, V]) *APIDataHandler_ParseResponse_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewAPIDataHandler creates a new instance of APIDataHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewAPIDataHandler[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/providers/base/api/handlers/mocks/api_fetcher.go b/providers/base/api/handlers/mocks/api_fetcher.go index f5c65035e..3367a4c81 100644 --- a/providers/base/api/handlers/mocks/api_fetcher.go +++ b/providers/base/api/handlers/mocks/api_fetcher.go @@ -15,6 +15,14 @@ type APIFetcher[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type APIFetcher_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *APIFetcher[K, V]) EXPECT() *APIFetcher_Expecter[K, V] { + return &APIFetcher_Expecter[K, V]{mock: &_m.Mock} +} + // Fetch provides a mock function with given fields: ctx, ids func (_m *APIFetcher[K, V]) Fetch(ctx context.Context, ids []K) types.GetResponse[K, V] { ret := _m.Called(ctx, ids) @@ -33,6 +41,35 @@ func (_m *APIFetcher[K, V]) Fetch(ctx context.Context, ids []K) types.GetRespons return r0 } +// APIFetcher_Fetch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fetch' +type APIFetcher_Fetch_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Fetch is a helper method to define mock.On call +// - ctx context.Context +// - ids []K +func (_e *APIFetcher_Expecter[K, V]) Fetch(ctx interface{}, ids interface{}) *APIFetcher_Fetch_Call[K, V] { + return &APIFetcher_Fetch_Call[K, V]{Call: _e.mock.On("Fetch", ctx, ids)} +} + +func (_c *APIFetcher_Fetch_Call[K, V]) Run(run func(ctx context.Context, ids []K)) *APIFetcher_Fetch_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]K)) + }) + return _c +} + +func (_c *APIFetcher_Fetch_Call[K, V]) Return(_a0 types.GetResponse[K, V]) *APIFetcher_Fetch_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *APIFetcher_Fetch_Call[K, V]) RunAndReturn(run func(context.Context, []K) types.GetResponse[K, V]) *APIFetcher_Fetch_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewAPIFetcher creates a new instance of APIFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewAPIFetcher[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/providers/base/api/handlers/mocks/api_query_handler.go b/providers/base/api/handlers/mocks/api_query_handler.go index af0cafe08..61c5f5c55 100644 --- a/providers/base/api/handlers/mocks/api_query_handler.go +++ b/providers/base/api/handlers/mocks/api_query_handler.go @@ -15,11 +15,49 @@ type APIQueryHandler[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type APIQueryHandler_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *APIQueryHandler[K, V]) EXPECT() *APIQueryHandler_Expecter[K, V] { + return &APIQueryHandler_Expecter[K, V]{mock: &_m.Mock} +} + // Query provides a mock function with given fields: ctx, ids, responseCh func (_m *APIQueryHandler[K, V]) Query(ctx context.Context, ids []K, responseCh chan<- types.GetResponse[K, V]) { _m.Called(ctx, ids, responseCh) } +// APIQueryHandler_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query' +type APIQueryHandler_Query_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Query is a helper method to define mock.On call +// - ctx context.Context +// - ids []K +// - responseCh chan<- types.GetResponse[K,V] +func (_e *APIQueryHandler_Expecter[K, V]) Query(ctx interface{}, ids interface{}, responseCh interface{}) *APIQueryHandler_Query_Call[K, V] { + return &APIQueryHandler_Query_Call[K, V]{Call: _e.mock.On("Query", ctx, ids, responseCh)} +} + +func (_c *APIQueryHandler_Query_Call[K, V]) Run(run func(ctx context.Context, ids []K, responseCh chan<- types.GetResponse[K, V])) *APIQueryHandler_Query_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]K), args[2].(chan<- types.GetResponse[K, V])) + }) + return _c +} + +func (_c *APIQueryHandler_Query_Call[K, V]) Return() *APIQueryHandler_Query_Call[K, V] { + _c.Call.Return() + return _c +} + +func (_c *APIQueryHandler_Query_Call[K, V]) RunAndReturn(run func(context.Context, []K, chan<- types.GetResponse[K, V])) *APIQueryHandler_Query_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewAPIQueryHandler creates a new instance of APIQueryHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewAPIQueryHandler[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/providers/base/api/handlers/mocks/request_handler.go b/providers/base/api/handlers/mocks/request_handler.go index 188db7af2..911db3f63 100644 --- a/providers/base/api/handlers/mocks/request_handler.go +++ b/providers/base/api/handlers/mocks/request_handler.go @@ -15,6 +15,14 @@ type RequestHandler struct { mock.Mock } +type RequestHandler_Expecter struct { + mock *mock.Mock +} + +func (_m *RequestHandler) EXPECT() *RequestHandler_Expecter { + return &RequestHandler_Expecter{mock: &_m.Mock} +} + // Do provides a mock function with given fields: ctx, url func (_m *RequestHandler) Do(ctx context.Context, url string) (*http.Response, error) { ret := _m.Called(ctx, url) @@ -45,6 +53,35 @@ func (_m *RequestHandler) Do(ctx context.Context, url string) (*http.Response, e return r0, r1 } +// RequestHandler_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do' +type RequestHandler_Do_Call struct { + *mock.Call +} + +// Do is a helper method to define mock.On call +// - ctx context.Context +// - url string +func (_e *RequestHandler_Expecter) Do(ctx interface{}, url interface{}) *RequestHandler_Do_Call { + return &RequestHandler_Do_Call{Call: _e.mock.On("Do", ctx, url)} +} + +func (_c *RequestHandler_Do_Call) Run(run func(ctx context.Context, url string)) *RequestHandler_Do_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *RequestHandler_Do_Call) Return(_a0 *http.Response, _a1 error) *RequestHandler_Do_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *RequestHandler_Do_Call) RunAndReturn(run func(context.Context, string) (*http.Response, error)) *RequestHandler_Do_Call { + _c.Call.Return(run) + return _c +} + // Type provides a mock function with given fields: func (_m *RequestHandler) Type() string { ret := _m.Called() @@ -63,6 +100,33 @@ func (_m *RequestHandler) Type() string { return r0 } +// RequestHandler_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type' +type RequestHandler_Type_Call struct { + *mock.Call +} + +// Type is a helper method to define mock.On call +func (_e *RequestHandler_Expecter) Type() *RequestHandler_Type_Call { + return &RequestHandler_Type_Call{Call: _e.mock.On("Type")} +} + +func (_c *RequestHandler_Type_Call) Run(run func()) *RequestHandler_Type_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *RequestHandler_Type_Call) Return(_a0 string) *RequestHandler_Type_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *RequestHandler_Type_Call) RunAndReturn(run func() string) *RequestHandler_Type_Call { + _c.Call.Return(run) + return _c +} + // NewRequestHandler creates a new instance of RequestHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewRequestHandler(t interface { diff --git a/providers/base/api/metrics/mocks/mock_metrics.go b/providers/base/api/metrics/mocks/mock_metrics.go index c590dac1b..ea501f6ab 100644 --- a/providers/base/api/metrics/mocks/mock_metrics.go +++ b/providers/base/api/metrics/mocks/mock_metrics.go @@ -19,26 +19,153 @@ type APIMetrics struct { mock.Mock } +type APIMetrics_Expecter struct { + mock *mock.Mock +} + +func (_m *APIMetrics) EXPECT() *APIMetrics_Expecter { + return &APIMetrics_Expecter{mock: &_m.Mock} +} + // AddHTTPStatusCode provides a mock function with given fields: providerName, resp func (_m *APIMetrics) AddHTTPStatusCode(providerName string, resp *http.Response) { _m.Called(providerName, resp) } +// APIMetrics_AddHTTPStatusCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddHTTPStatusCode' +type APIMetrics_AddHTTPStatusCode_Call struct { + *mock.Call +} + +// AddHTTPStatusCode is a helper method to define mock.On call +// - providerName string +// - resp *http.Response +func (_e *APIMetrics_Expecter) AddHTTPStatusCode(providerName interface{}, resp interface{}) *APIMetrics_AddHTTPStatusCode_Call { + return &APIMetrics_AddHTTPStatusCode_Call{Call: _e.mock.On("AddHTTPStatusCode", providerName, resp)} +} + +func (_c *APIMetrics_AddHTTPStatusCode_Call) Run(run func(providerName string, resp *http.Response)) *APIMetrics_AddHTTPStatusCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(*http.Response)) + }) + return _c +} + +func (_c *APIMetrics_AddHTTPStatusCode_Call) Return() *APIMetrics_AddHTTPStatusCode_Call { + _c.Call.Return() + return _c +} + +func (_c *APIMetrics_AddHTTPStatusCode_Call) RunAndReturn(run func(string, *http.Response)) *APIMetrics_AddHTTPStatusCode_Call { + _c.Call.Return(run) + return _c +} + // AddProviderResponse provides a mock function with given fields: providerName, id, errorCode func (_m *APIMetrics) AddProviderResponse(providerName string, id string, errorCode types.ErrorCode) { _m.Called(providerName, id, errorCode) } +// APIMetrics_AddProviderResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddProviderResponse' +type APIMetrics_AddProviderResponse_Call struct { + *mock.Call +} + +// AddProviderResponse is a helper method to define mock.On call +// - providerName string +// - id string +// - errorCode types.ErrorCode +func (_e *APIMetrics_Expecter) AddProviderResponse(providerName interface{}, id interface{}, errorCode interface{}) *APIMetrics_AddProviderResponse_Call { + return &APIMetrics_AddProviderResponse_Call{Call: _e.mock.On("AddProviderResponse", providerName, id, errorCode)} +} + +func (_c *APIMetrics_AddProviderResponse_Call) Run(run func(providerName string, id string, errorCode types.ErrorCode)) *APIMetrics_AddProviderResponse_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(types.ErrorCode)) + }) + return _c +} + +func (_c *APIMetrics_AddProviderResponse_Call) Return() *APIMetrics_AddProviderResponse_Call { + _c.Call.Return() + return _c +} + +func (_c *APIMetrics_AddProviderResponse_Call) RunAndReturn(run func(string, string, types.ErrorCode)) *APIMetrics_AddProviderResponse_Call { + _c.Call.Return(run) + return _c +} + // AddRPCStatusCode provides a mock function with given fields: providerName, endpoint, code func (_m *APIMetrics) AddRPCStatusCode(providerName string, endpoint string, code metrics.RPCCode) { _m.Called(providerName, endpoint, code) } +// APIMetrics_AddRPCStatusCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRPCStatusCode' +type APIMetrics_AddRPCStatusCode_Call struct { + *mock.Call +} + +// AddRPCStatusCode is a helper method to define mock.On call +// - providerName string +// - endpoint string +// - code metrics.RPCCode +func (_e *APIMetrics_Expecter) AddRPCStatusCode(providerName interface{}, endpoint interface{}, code interface{}) *APIMetrics_AddRPCStatusCode_Call { + return &APIMetrics_AddRPCStatusCode_Call{Call: _e.mock.On("AddRPCStatusCode", providerName, endpoint, code)} +} + +func (_c *APIMetrics_AddRPCStatusCode_Call) Run(run func(providerName string, endpoint string, code metrics.RPCCode)) *APIMetrics_AddRPCStatusCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(metrics.RPCCode)) + }) + return _c +} + +func (_c *APIMetrics_AddRPCStatusCode_Call) Return() *APIMetrics_AddRPCStatusCode_Call { + _c.Call.Return() + return _c +} + +func (_c *APIMetrics_AddRPCStatusCode_Call) RunAndReturn(run func(string, string, metrics.RPCCode)) *APIMetrics_AddRPCStatusCode_Call { + _c.Call.Return(run) + return _c +} + // ObserveProviderResponseLatency provides a mock function with given fields: providerName, endpoint, duration func (_m *APIMetrics) ObserveProviderResponseLatency(providerName string, endpoint string, duration time.Duration) { _m.Called(providerName, endpoint, duration) } +// APIMetrics_ObserveProviderResponseLatency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObserveProviderResponseLatency' +type APIMetrics_ObserveProviderResponseLatency_Call struct { + *mock.Call +} + +// ObserveProviderResponseLatency is a helper method to define mock.On call +// - providerName string +// - endpoint string +// - duration time.Duration +func (_e *APIMetrics_Expecter) ObserveProviderResponseLatency(providerName interface{}, endpoint interface{}, duration interface{}) *APIMetrics_ObserveProviderResponseLatency_Call { + return &APIMetrics_ObserveProviderResponseLatency_Call{Call: _e.mock.On("ObserveProviderResponseLatency", providerName, endpoint, duration)} +} + +func (_c *APIMetrics_ObserveProviderResponseLatency_Call) Run(run func(providerName string, endpoint string, duration time.Duration)) *APIMetrics_ObserveProviderResponseLatency_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(time.Duration)) + }) + return _c +} + +func (_c *APIMetrics_ObserveProviderResponseLatency_Call) Return() *APIMetrics_ObserveProviderResponseLatency_Call { + _c.Call.Return() + return _c +} + +func (_c *APIMetrics_ObserveProviderResponseLatency_Call) RunAndReturn(run func(string, string, time.Duration)) *APIMetrics_ObserveProviderResponseLatency_Call { + _c.Call.Return(run) + return _c +} + // NewAPIMetrics creates a new instance of APIMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewAPIMetrics(t interface { diff --git a/providers/base/metrics/mocks/mock_metrics.go b/providers/base/metrics/mocks/mock_metrics.go index e676d3127..65eac04fd 100644 --- a/providers/base/metrics/mocks/mock_metrics.go +++ b/providers/base/metrics/mocks/mock_metrics.go @@ -15,21 +15,122 @@ type ProviderMetrics struct { mock.Mock } +type ProviderMetrics_Expecter struct { + mock *mock.Mock +} + +func (_m *ProviderMetrics) EXPECT() *ProviderMetrics_Expecter { + return &ProviderMetrics_Expecter{mock: &_m.Mock} +} + // AddProviderResponse provides a mock function with given fields: providerName, status, ec, providerType func (_m *ProviderMetrics) AddProviderResponse(providerName string, status metrics.Status, ec types.ErrorCode, providerType types.ProviderType) { _m.Called(providerName, status, ec, providerType) } +// ProviderMetrics_AddProviderResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddProviderResponse' +type ProviderMetrics_AddProviderResponse_Call struct { + *mock.Call +} + +// AddProviderResponse is a helper method to define mock.On call +// - providerName string +// - status metrics.Status +// - ec types.ErrorCode +// - providerType types.ProviderType +func (_e *ProviderMetrics_Expecter) AddProviderResponse(providerName interface{}, status interface{}, ec interface{}, providerType interface{}) *ProviderMetrics_AddProviderResponse_Call { + return &ProviderMetrics_AddProviderResponse_Call{Call: _e.mock.On("AddProviderResponse", providerName, status, ec, providerType)} +} + +func (_c *ProviderMetrics_AddProviderResponse_Call) Run(run func(providerName string, status metrics.Status, ec types.ErrorCode, providerType types.ProviderType)) *ProviderMetrics_AddProviderResponse_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(metrics.Status), args[2].(types.ErrorCode), args[3].(types.ProviderType)) + }) + return _c +} + +func (_c *ProviderMetrics_AddProviderResponse_Call) Return() *ProviderMetrics_AddProviderResponse_Call { + _c.Call.Return() + return _c +} + +func (_c *ProviderMetrics_AddProviderResponse_Call) RunAndReturn(run func(string, metrics.Status, types.ErrorCode, types.ProviderType)) *ProviderMetrics_AddProviderResponse_Call { + _c.Call.Return(run) + return _c +} + // AddProviderResponseByID provides a mock function with given fields: providerName, id, status, ec, providerType func (_m *ProviderMetrics) AddProviderResponseByID(providerName string, id string, status metrics.Status, ec types.ErrorCode, providerType types.ProviderType) { _m.Called(providerName, id, status, ec, providerType) } +// ProviderMetrics_AddProviderResponseByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddProviderResponseByID' +type ProviderMetrics_AddProviderResponseByID_Call struct { + *mock.Call +} + +// AddProviderResponseByID is a helper method to define mock.On call +// - providerName string +// - id string +// - status metrics.Status +// - ec types.ErrorCode +// - providerType types.ProviderType +func (_e *ProviderMetrics_Expecter) AddProviderResponseByID(providerName interface{}, id interface{}, status interface{}, ec interface{}, providerType interface{}) *ProviderMetrics_AddProviderResponseByID_Call { + return &ProviderMetrics_AddProviderResponseByID_Call{Call: _e.mock.On("AddProviderResponseByID", providerName, id, status, ec, providerType)} +} + +func (_c *ProviderMetrics_AddProviderResponseByID_Call) Run(run func(providerName string, id string, status metrics.Status, ec types.ErrorCode, providerType types.ProviderType)) *ProviderMetrics_AddProviderResponseByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(metrics.Status), args[3].(types.ErrorCode), args[4].(types.ProviderType)) + }) + return _c +} + +func (_c *ProviderMetrics_AddProviderResponseByID_Call) Return() *ProviderMetrics_AddProviderResponseByID_Call { + _c.Call.Return() + return _c +} + +func (_c *ProviderMetrics_AddProviderResponseByID_Call) RunAndReturn(run func(string, string, metrics.Status, types.ErrorCode, types.ProviderType)) *ProviderMetrics_AddProviderResponseByID_Call { + _c.Call.Return(run) + return _c +} + // LastUpdated provides a mock function with given fields: providerName, id, providerType func (_m *ProviderMetrics) LastUpdated(providerName string, id string, providerType types.ProviderType) { _m.Called(providerName, id, providerType) } +// ProviderMetrics_LastUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LastUpdated' +type ProviderMetrics_LastUpdated_Call struct { + *mock.Call +} + +// LastUpdated is a helper method to define mock.On call +// - providerName string +// - id string +// - providerType types.ProviderType +func (_e *ProviderMetrics_Expecter) LastUpdated(providerName interface{}, id interface{}, providerType interface{}) *ProviderMetrics_LastUpdated_Call { + return &ProviderMetrics_LastUpdated_Call{Call: _e.mock.On("LastUpdated", providerName, id, providerType)} +} + +func (_c *ProviderMetrics_LastUpdated_Call) Run(run func(providerName string, id string, providerType types.ProviderType)) *ProviderMetrics_LastUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(types.ProviderType)) + }) + return _c +} + +func (_c *ProviderMetrics_LastUpdated_Call) Return() *ProviderMetrics_LastUpdated_Call { + _c.Call.Return() + return _c +} + +func (_c *ProviderMetrics_LastUpdated_Call) RunAndReturn(run func(string, string, types.ProviderType)) *ProviderMetrics_LastUpdated_Call { + _c.Call.Return(run) + return _c +} + // NewProviderMetrics creates a new instance of ProviderMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewProviderMetrics(t interface { diff --git a/providers/base/websocket/handlers/mocks/web_socket_conn_handler.go b/providers/base/websocket/handlers/mocks/web_socket_conn_handler.go index 145235c27..09549ac71 100644 --- a/providers/base/websocket/handlers/mocks/web_socket_conn_handler.go +++ b/providers/base/websocket/handlers/mocks/web_socket_conn_handler.go @@ -13,6 +13,14 @@ type WebSocketConnHandler struct { mock.Mock } +type WebSocketConnHandler_Expecter struct { + mock *mock.Mock +} + +func (_m *WebSocketConnHandler) EXPECT() *WebSocketConnHandler_Expecter { + return &WebSocketConnHandler_Expecter{mock: &_m.Mock} +} + // Close provides a mock function with given fields: func (_m *WebSocketConnHandler) Close() error { ret := _m.Called() @@ -31,6 +39,33 @@ func (_m *WebSocketConnHandler) Close() error { return r0 } +// WebSocketConnHandler_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type WebSocketConnHandler_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *WebSocketConnHandler_Expecter) Close() *WebSocketConnHandler_Close_Call { + return &WebSocketConnHandler_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *WebSocketConnHandler_Close_Call) Run(run func()) *WebSocketConnHandler_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketConnHandler_Close_Call) Return(_a0 error) *WebSocketConnHandler_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketConnHandler_Close_Call) RunAndReturn(run func() error) *WebSocketConnHandler_Close_Call { + _c.Call.Return(run) + return _c +} + // Copy provides a mock function with given fields: func (_m *WebSocketConnHandler) Copy() handlers.WebSocketConnHandler { ret := _m.Called() @@ -51,6 +86,33 @@ func (_m *WebSocketConnHandler) Copy() handlers.WebSocketConnHandler { return r0 } +// WebSocketConnHandler_Copy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Copy' +type WebSocketConnHandler_Copy_Call struct { + *mock.Call +} + +// Copy is a helper method to define mock.On call +func (_e *WebSocketConnHandler_Expecter) Copy() *WebSocketConnHandler_Copy_Call { + return &WebSocketConnHandler_Copy_Call{Call: _e.mock.On("Copy")} +} + +func (_c *WebSocketConnHandler_Copy_Call) Run(run func()) *WebSocketConnHandler_Copy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketConnHandler_Copy_Call) Return(_a0 handlers.WebSocketConnHandler) *WebSocketConnHandler_Copy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketConnHandler_Copy_Call) RunAndReturn(run func() handlers.WebSocketConnHandler) *WebSocketConnHandler_Copy_Call { + _c.Call.Return(run) + return _c +} + // Dial provides a mock function with given fields: func (_m *WebSocketConnHandler) Dial() error { ret := _m.Called() @@ -69,6 +131,33 @@ func (_m *WebSocketConnHandler) Dial() error { return r0 } +// WebSocketConnHandler_Dial_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dial' +type WebSocketConnHandler_Dial_Call struct { + *mock.Call +} + +// Dial is a helper method to define mock.On call +func (_e *WebSocketConnHandler_Expecter) Dial() *WebSocketConnHandler_Dial_Call { + return &WebSocketConnHandler_Dial_Call{Call: _e.mock.On("Dial")} +} + +func (_c *WebSocketConnHandler_Dial_Call) Run(run func()) *WebSocketConnHandler_Dial_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketConnHandler_Dial_Call) Return(_a0 error) *WebSocketConnHandler_Dial_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketConnHandler_Dial_Call) RunAndReturn(run func() error) *WebSocketConnHandler_Dial_Call { + _c.Call.Return(run) + return _c +} + // Read provides a mock function with given fields: func (_m *WebSocketConnHandler) Read() ([]byte, error) { ret := _m.Called() @@ -99,6 +188,33 @@ func (_m *WebSocketConnHandler) Read() ([]byte, error) { return r0, r1 } +// WebSocketConnHandler_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' +type WebSocketConnHandler_Read_Call struct { + *mock.Call +} + +// Read is a helper method to define mock.On call +func (_e *WebSocketConnHandler_Expecter) Read() *WebSocketConnHandler_Read_Call { + return &WebSocketConnHandler_Read_Call{Call: _e.mock.On("Read")} +} + +func (_c *WebSocketConnHandler_Read_Call) Run(run func()) *WebSocketConnHandler_Read_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketConnHandler_Read_Call) Return(_a0 []byte, _a1 error) *WebSocketConnHandler_Read_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebSocketConnHandler_Read_Call) RunAndReturn(run func() ([]byte, error)) *WebSocketConnHandler_Read_Call { + _c.Call.Return(run) + return _c +} + // Write provides a mock function with given fields: message func (_m *WebSocketConnHandler) Write(message []byte) error { ret := _m.Called(message) @@ -117,6 +233,34 @@ func (_m *WebSocketConnHandler) Write(message []byte) error { return r0 } +// WebSocketConnHandler_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type WebSocketConnHandler_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - message []byte +func (_e *WebSocketConnHandler_Expecter) Write(message interface{}) *WebSocketConnHandler_Write_Call { + return &WebSocketConnHandler_Write_Call{Call: _e.mock.On("Write", message)} +} + +func (_c *WebSocketConnHandler_Write_Call) Run(run func(message []byte)) *WebSocketConnHandler_Write_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *WebSocketConnHandler_Write_Call) Return(_a0 error) *WebSocketConnHandler_Write_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketConnHandler_Write_Call) RunAndReturn(run func([]byte) error) *WebSocketConnHandler_Write_Call { + _c.Call.Return(run) + return _c +} + // NewWebSocketConnHandler creates a new instance of WebSocketConnHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewWebSocketConnHandler(t interface { diff --git a/providers/base/websocket/handlers/mocks/web_socket_data_handler.go b/providers/base/websocket/handlers/mocks/web_socket_data_handler.go index 7dc10632e..1059aa89f 100644 --- a/providers/base/websocket/handlers/mocks/web_socket_data_handler.go +++ b/providers/base/websocket/handlers/mocks/web_socket_data_handler.go @@ -15,6 +15,14 @@ type WebSocketDataHandler[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type WebSocketDataHandler_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *WebSocketDataHandler[K, V]) EXPECT() *WebSocketDataHandler_Expecter[K, V] { + return &WebSocketDataHandler_Expecter[K, V]{mock: &_m.Mock} +} + // Copy provides a mock function with given fields: func (_m *WebSocketDataHandler[K, V]) Copy() handlers.WebSocketDataHandler[K, V] { ret := _m.Called() @@ -35,6 +43,33 @@ func (_m *WebSocketDataHandler[K, V]) Copy() handlers.WebSocketDataHandler[K, V] return r0 } +// WebSocketDataHandler_Copy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Copy' +type WebSocketDataHandler_Copy_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Copy is a helper method to define mock.On call +func (_e *WebSocketDataHandler_Expecter[K, V]) Copy() *WebSocketDataHandler_Copy_Call[K, V] { + return &WebSocketDataHandler_Copy_Call[K, V]{Call: _e.mock.On("Copy")} +} + +func (_c *WebSocketDataHandler_Copy_Call[K, V]) Run(run func()) *WebSocketDataHandler_Copy_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketDataHandler_Copy_Call[K, V]) Return(_a0 handlers.WebSocketDataHandler[K, V]) *WebSocketDataHandler_Copy_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketDataHandler_Copy_Call[K, V]) RunAndReturn(run func() handlers.WebSocketDataHandler[K, V]) *WebSocketDataHandler_Copy_Call[K, V] { + _c.Call.Return(run) + return _c +} + // CreateMessages provides a mock function with given fields: ids func (_m *WebSocketDataHandler[K, V]) CreateMessages(ids []K) ([]handlers.WebsocketEncodedMessage, error) { ret := _m.Called(ids) @@ -65,6 +100,34 @@ func (_m *WebSocketDataHandler[K, V]) CreateMessages(ids []K) ([]handlers.Websoc return r0, r1 } +// WebSocketDataHandler_CreateMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMessages' +type WebSocketDataHandler_CreateMessages_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// CreateMessages is a helper method to define mock.On call +// - ids []K +func (_e *WebSocketDataHandler_Expecter[K, V]) CreateMessages(ids interface{}) *WebSocketDataHandler_CreateMessages_Call[K, V] { + return &WebSocketDataHandler_CreateMessages_Call[K, V]{Call: _e.mock.On("CreateMessages", ids)} +} + +func (_c *WebSocketDataHandler_CreateMessages_Call[K, V]) Run(run func(ids []K)) *WebSocketDataHandler_CreateMessages_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]K)) + }) + return _c +} + +func (_c *WebSocketDataHandler_CreateMessages_Call[K, V]) Return(_a0 []handlers.WebsocketEncodedMessage, _a1 error) *WebSocketDataHandler_CreateMessages_Call[K, V] { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebSocketDataHandler_CreateMessages_Call[K, V]) RunAndReturn(run func([]K) ([]handlers.WebsocketEncodedMessage, error)) *WebSocketDataHandler_CreateMessages_Call[K, V] { + _c.Call.Return(run) + return _c +} + // HandleMessage provides a mock function with given fields: message func (_m *WebSocketDataHandler[K, V]) HandleMessage(message []byte) (types.GetResponse[K, V], []handlers.WebsocketEncodedMessage, error) { ret := _m.Called(message) @@ -102,6 +165,34 @@ func (_m *WebSocketDataHandler[K, V]) HandleMessage(message []byte) (types.GetRe return r0, r1, r2 } +// WebSocketDataHandler_HandleMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleMessage' +type WebSocketDataHandler_HandleMessage_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// HandleMessage is a helper method to define mock.On call +// - message []byte +func (_e *WebSocketDataHandler_Expecter[K, V]) HandleMessage(message interface{}) *WebSocketDataHandler_HandleMessage_Call[K, V] { + return &WebSocketDataHandler_HandleMessage_Call[K, V]{Call: _e.mock.On("HandleMessage", message)} +} + +func (_c *WebSocketDataHandler_HandleMessage_Call[K, V]) Run(run func(message []byte)) *WebSocketDataHandler_HandleMessage_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *WebSocketDataHandler_HandleMessage_Call[K, V]) Return(response types.GetResponse[K, V], updateMessages []handlers.WebsocketEncodedMessage, err error) *WebSocketDataHandler_HandleMessage_Call[K, V] { + _c.Call.Return(response, updateMessages, err) + return _c +} + +func (_c *WebSocketDataHandler_HandleMessage_Call[K, V]) RunAndReturn(run func([]byte) (types.GetResponse[K, V], []handlers.WebsocketEncodedMessage, error)) *WebSocketDataHandler_HandleMessage_Call[K, V] { + _c.Call.Return(run) + return _c +} + // HeartBeatMessages provides a mock function with given fields: func (_m *WebSocketDataHandler[K, V]) HeartBeatMessages() ([]handlers.WebsocketEncodedMessage, error) { ret := _m.Called() @@ -132,6 +223,33 @@ func (_m *WebSocketDataHandler[K, V]) HeartBeatMessages() ([]handlers.WebsocketE return r0, r1 } +// WebSocketDataHandler_HeartBeatMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeartBeatMessages' +type WebSocketDataHandler_HeartBeatMessages_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// HeartBeatMessages is a helper method to define mock.On call +func (_e *WebSocketDataHandler_Expecter[K, V]) HeartBeatMessages() *WebSocketDataHandler_HeartBeatMessages_Call[K, V] { + return &WebSocketDataHandler_HeartBeatMessages_Call[K, V]{Call: _e.mock.On("HeartBeatMessages")} +} + +func (_c *WebSocketDataHandler_HeartBeatMessages_Call[K, V]) Run(run func()) *WebSocketDataHandler_HeartBeatMessages_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketDataHandler_HeartBeatMessages_Call[K, V]) Return(_a0 []handlers.WebsocketEncodedMessage, _a1 error) *WebSocketDataHandler_HeartBeatMessages_Call[K, V] { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebSocketDataHandler_HeartBeatMessages_Call[K, V]) RunAndReturn(run func() ([]handlers.WebsocketEncodedMessage, error)) *WebSocketDataHandler_HeartBeatMessages_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewWebSocketDataHandler creates a new instance of WebSocketDataHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewWebSocketDataHandler[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/providers/base/websocket/handlers/mocks/web_socket_query_handler.go b/providers/base/websocket/handlers/mocks/web_socket_query_handler.go index c2591760d..9352443f0 100644 --- a/providers/base/websocket/handlers/mocks/web_socket_query_handler.go +++ b/providers/base/websocket/handlers/mocks/web_socket_query_handler.go @@ -17,6 +17,14 @@ type WebSocketQueryHandler[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type WebSocketQueryHandler_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *WebSocketQueryHandler[K, V]) EXPECT() *WebSocketQueryHandler_Expecter[K, V] { + return &WebSocketQueryHandler_Expecter[K, V]{mock: &_m.Mock} +} + // Copy provides a mock function with given fields: func (_m *WebSocketQueryHandler[K, V]) Copy() handlers.WebSocketQueryHandler[K, V] { ret := _m.Called() @@ -37,6 +45,33 @@ func (_m *WebSocketQueryHandler[K, V]) Copy() handlers.WebSocketQueryHandler[K, return r0 } +// WebSocketQueryHandler_Copy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Copy' +type WebSocketQueryHandler_Copy_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Copy is a helper method to define mock.On call +func (_e *WebSocketQueryHandler_Expecter[K, V]) Copy() *WebSocketQueryHandler_Copy_Call[K, V] { + return &WebSocketQueryHandler_Copy_Call[K, V]{Call: _e.mock.On("Copy")} +} + +func (_c *WebSocketQueryHandler_Copy_Call[K, V]) Run(run func()) *WebSocketQueryHandler_Copy_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebSocketQueryHandler_Copy_Call[K, V]) Return(_a0 handlers.WebSocketQueryHandler[K, V]) *WebSocketQueryHandler_Copy_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketQueryHandler_Copy_Call[K, V]) RunAndReturn(run func() handlers.WebSocketQueryHandler[K, V]) *WebSocketQueryHandler_Copy_Call[K, V] { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: ctx, ids, responseCh func (_m *WebSocketQueryHandler[K, V]) Start(ctx context.Context, ids []K, responseCh chan<- types.GetResponse[K, V]) error { ret := _m.Called(ctx, ids, responseCh) @@ -55,6 +90,36 @@ func (_m *WebSocketQueryHandler[K, V]) Start(ctx context.Context, ids []K, respo return r0 } +// WebSocketQueryHandler_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type WebSocketQueryHandler_Start_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - ctx context.Context +// - ids []K +// - responseCh chan<- types.GetResponse[K,V] +func (_e *WebSocketQueryHandler_Expecter[K, V]) Start(ctx interface{}, ids interface{}, responseCh interface{}) *WebSocketQueryHandler_Start_Call[K, V] { + return &WebSocketQueryHandler_Start_Call[K, V]{Call: _e.mock.On("Start", ctx, ids, responseCh)} +} + +func (_c *WebSocketQueryHandler_Start_Call[K, V]) Run(run func(ctx context.Context, ids []K, responseCh chan<- types.GetResponse[K, V])) *WebSocketQueryHandler_Start_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]K), args[2].(chan<- types.GetResponse[K, V])) + }) + return _c +} + +func (_c *WebSocketQueryHandler_Start_Call[K, V]) Return(_a0 error) *WebSocketQueryHandler_Start_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebSocketQueryHandler_Start_Call[K, V]) RunAndReturn(run func(context.Context, []K, chan<- types.GetResponse[K, V]) error) *WebSocketQueryHandler_Start_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewWebSocketQueryHandler creates a new instance of WebSocketQueryHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewWebSocketQueryHandler[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/providers/base/websocket/metrics/mocks/mock_metrics.go b/providers/base/websocket/metrics/mocks/mock_metrics.go index f5aec0bbc..ac8149596 100644 --- a/providers/base/websocket/metrics/mocks/mock_metrics.go +++ b/providers/base/websocket/metrics/mocks/mock_metrics.go @@ -15,21 +15,116 @@ type WebSocketMetrics struct { mock.Mock } +type WebSocketMetrics_Expecter struct { + mock *mock.Mock +} + +func (_m *WebSocketMetrics) EXPECT() *WebSocketMetrics_Expecter { + return &WebSocketMetrics_Expecter{mock: &_m.Mock} +} + // AddWebSocketConnectionStatus provides a mock function with given fields: provider, status func (_m *WebSocketMetrics) AddWebSocketConnectionStatus(provider string, status metrics.ConnectionStatus) { _m.Called(provider, status) } +// WebSocketMetrics_AddWebSocketConnectionStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddWebSocketConnectionStatus' +type WebSocketMetrics_AddWebSocketConnectionStatus_Call struct { + *mock.Call +} + +// AddWebSocketConnectionStatus is a helper method to define mock.On call +// - provider string +// - status metrics.ConnectionStatus +func (_e *WebSocketMetrics_Expecter) AddWebSocketConnectionStatus(provider interface{}, status interface{}) *WebSocketMetrics_AddWebSocketConnectionStatus_Call { + return &WebSocketMetrics_AddWebSocketConnectionStatus_Call{Call: _e.mock.On("AddWebSocketConnectionStatus", provider, status)} +} + +func (_c *WebSocketMetrics_AddWebSocketConnectionStatus_Call) Run(run func(provider string, status metrics.ConnectionStatus)) *WebSocketMetrics_AddWebSocketConnectionStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(metrics.ConnectionStatus)) + }) + return _c +} + +func (_c *WebSocketMetrics_AddWebSocketConnectionStatus_Call) Return() *WebSocketMetrics_AddWebSocketConnectionStatus_Call { + _c.Call.Return() + return _c +} + +func (_c *WebSocketMetrics_AddWebSocketConnectionStatus_Call) RunAndReturn(run func(string, metrics.ConnectionStatus)) *WebSocketMetrics_AddWebSocketConnectionStatus_Call { + _c.Call.Return(run) + return _c +} + // AddWebSocketDataHandlerStatus provides a mock function with given fields: provider, status func (_m *WebSocketMetrics) AddWebSocketDataHandlerStatus(provider string, status metrics.HandlerStatus) { _m.Called(provider, status) } +// WebSocketMetrics_AddWebSocketDataHandlerStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddWebSocketDataHandlerStatus' +type WebSocketMetrics_AddWebSocketDataHandlerStatus_Call struct { + *mock.Call +} + +// AddWebSocketDataHandlerStatus is a helper method to define mock.On call +// - provider string +// - status metrics.HandlerStatus +func (_e *WebSocketMetrics_Expecter) AddWebSocketDataHandlerStatus(provider interface{}, status interface{}) *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call { + return &WebSocketMetrics_AddWebSocketDataHandlerStatus_Call{Call: _e.mock.On("AddWebSocketDataHandlerStatus", provider, status)} +} + +func (_c *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call) Run(run func(provider string, status metrics.HandlerStatus)) *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(metrics.HandlerStatus)) + }) + return _c +} + +func (_c *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call) Return() *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call { + _c.Call.Return() + return _c +} + +func (_c *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call) RunAndReturn(run func(string, metrics.HandlerStatus)) *WebSocketMetrics_AddWebSocketDataHandlerStatus_Call { + _c.Call.Return(run) + return _c +} + // ObserveWebSocketLatency provides a mock function with given fields: provider, duration func (_m *WebSocketMetrics) ObserveWebSocketLatency(provider string, duration time.Duration) { _m.Called(provider, duration) } +// WebSocketMetrics_ObserveWebSocketLatency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObserveWebSocketLatency' +type WebSocketMetrics_ObserveWebSocketLatency_Call struct { + *mock.Call +} + +// ObserveWebSocketLatency is a helper method to define mock.On call +// - provider string +// - duration time.Duration +func (_e *WebSocketMetrics_Expecter) ObserveWebSocketLatency(provider interface{}, duration interface{}) *WebSocketMetrics_ObserveWebSocketLatency_Call { + return &WebSocketMetrics_ObserveWebSocketLatency_Call{Call: _e.mock.On("ObserveWebSocketLatency", provider, duration)} +} + +func (_c *WebSocketMetrics_ObserveWebSocketLatency_Call) Run(run func(provider string, duration time.Duration)) *WebSocketMetrics_ObserveWebSocketLatency_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(time.Duration)) + }) + return _c +} + +func (_c *WebSocketMetrics_ObserveWebSocketLatency_Call) Return() *WebSocketMetrics_ObserveWebSocketLatency_Call { + _c.Call.Return() + return _c +} + +func (_c *WebSocketMetrics_ObserveWebSocketLatency_Call) RunAndReturn(run func(string, time.Duration)) *WebSocketMetrics_ObserveWebSocketLatency_Call { + _c.Call.Return(run) + return _c +} + // NewWebSocketMetrics creates a new instance of WebSocketMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewWebSocketMetrics(t interface { diff --git a/providers/types/mocks/mock_provider.go b/providers/types/mocks/mock_provider.go index bc9231dd0..2554493ff 100644 --- a/providers/types/mocks/mock_provider.go +++ b/providers/types/mocks/mock_provider.go @@ -15,6 +15,14 @@ type Provider[K types.ResponseKey, V types.ResponseValue] struct { mock.Mock } +type Provider_Expecter[K types.ResponseKey, V types.ResponseValue] struct { + mock *mock.Mock +} + +func (_m *Provider[K, V]) EXPECT() *Provider_Expecter[K, V] { + return &Provider_Expecter[K, V]{mock: &_m.Mock} +} + // GetData provides a mock function with given fields: func (_m *Provider[K, V]) GetData() map[K]types.ResolvedResult[V] { ret := _m.Called() @@ -35,6 +43,33 @@ func (_m *Provider[K, V]) GetData() map[K]types.ResolvedResult[V] { return r0 } +// Provider_GetData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetData' +type Provider_GetData_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// GetData is a helper method to define mock.On call +func (_e *Provider_Expecter[K, V]) GetData() *Provider_GetData_Call[K, V] { + return &Provider_GetData_Call[K, V]{Call: _e.mock.On("GetData")} +} + +func (_c *Provider_GetData_Call[K, V]) Run(run func()) *Provider_GetData_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_GetData_Call[K, V]) Return(_a0 map[K]types.ResolvedResult[V]) *Provider_GetData_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_GetData_Call[K, V]) RunAndReturn(run func() map[K]types.ResolvedResult[V]) *Provider_GetData_Call[K, V] { + _c.Call.Return(run) + return _c +} + // IsRunning provides a mock function with given fields: func (_m *Provider[K, V]) IsRunning() bool { ret := _m.Called() @@ -53,6 +88,33 @@ func (_m *Provider[K, V]) IsRunning() bool { return r0 } +// Provider_IsRunning_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsRunning' +type Provider_IsRunning_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// IsRunning is a helper method to define mock.On call +func (_e *Provider_Expecter[K, V]) IsRunning() *Provider_IsRunning_Call[K, V] { + return &Provider_IsRunning_Call[K, V]{Call: _e.mock.On("IsRunning")} +} + +func (_c *Provider_IsRunning_Call[K, V]) Run(run func()) *Provider_IsRunning_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_IsRunning_Call[K, V]) Return(_a0 bool) *Provider_IsRunning_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_IsRunning_Call[K, V]) RunAndReturn(run func() bool) *Provider_IsRunning_Call[K, V] { + _c.Call.Return(run) + return _c +} + // Name provides a mock function with given fields: func (_m *Provider[K, V]) Name() string { ret := _m.Called() @@ -71,6 +133,33 @@ func (_m *Provider[K, V]) Name() string { return r0 } +// Provider_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type Provider_Name_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *Provider_Expecter[K, V]) Name() *Provider_Name_Call[K, V] { + return &Provider_Name_Call[K, V]{Call: _e.mock.On("Name")} +} + +func (_c *Provider_Name_Call[K, V]) Run(run func()) *Provider_Name_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_Name_Call[K, V]) Return(_a0 string) *Provider_Name_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_Name_Call[K, V]) RunAndReturn(run func() string) *Provider_Name_Call[K, V] { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *Provider[K, V]) Start(_a0 context.Context) error { ret := _m.Called(_a0) @@ -89,6 +178,34 @@ func (_m *Provider[K, V]) Start(_a0 context.Context) error { return r0 } +// Provider_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type Provider_Start_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - _a0 context.Context +func (_e *Provider_Expecter[K, V]) Start(_a0 interface{}) *Provider_Start_Call[K, V] { + return &Provider_Start_Call[K, V]{Call: _e.mock.On("Start", _a0)} +} + +func (_c *Provider_Start_Call[K, V]) Run(run func(_a0 context.Context)) *Provider_Start_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Provider_Start_Call[K, V]) Return(_a0 error) *Provider_Start_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_Start_Call[K, V]) RunAndReturn(run func(context.Context) error) *Provider_Start_Call[K, V] { + _c.Call.Return(run) + return _c +} + // Type provides a mock function with given fields: func (_m *Provider[K, V]) Type() types.ProviderType { ret := _m.Called() @@ -107,6 +224,33 @@ func (_m *Provider[K, V]) Type() types.ProviderType { return r0 } +// Provider_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type' +type Provider_Type_Call[K types.ResponseKey, V types.ResponseValue] struct { + *mock.Call +} + +// Type is a helper method to define mock.On call +func (_e *Provider_Expecter[K, V]) Type() *Provider_Type_Call[K, V] { + return &Provider_Type_Call[K, V]{Call: _e.mock.On("Type")} +} + +func (_c *Provider_Type_Call[K, V]) Run(run func()) *Provider_Type_Call[K, V] { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Provider_Type_Call[K, V]) Return(_a0 types.ProviderType) *Provider_Type_Call[K, V] { + _c.Call.Return(_a0) + return _c +} + +func (_c *Provider_Type_Call[K, V]) RunAndReturn(run func() types.ProviderType) *Provider_Type_Call[K, V] { + _c.Call.Return(run) + return _c +} + // NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewProvider[K types.ResponseKey, V types.ResponseValue](t interface { diff --git a/service/clients/oracle/mocks/mock_oracle_client.go b/service/clients/oracle/mocks/mock_oracle_client.go index 86223f2a6..753997783 100644 --- a/service/clients/oracle/mocks/mock_oracle_client.go +++ b/service/clients/oracle/mocks/mock_oracle_client.go @@ -17,6 +17,14 @@ type OracleClient struct { mock.Mock } +type OracleClient_Expecter struct { + mock *mock.Mock +} + +func (_m *OracleClient) EXPECT() *OracleClient_Expecter { + return &OracleClient_Expecter{mock: &_m.Mock} +} + // MarketMap provides a mock function with given fields: ctx, in, opts func (_m *OracleClient) MarketMap(ctx context.Context, in *types.QueryMarketMapRequest, opts ...grpc.CallOption) (*types.QueryMarketMapResponse, error) { _va := make([]interface{}, len(opts)) @@ -54,6 +62,43 @@ func (_m *OracleClient) MarketMap(ctx context.Context, in *types.QueryMarketMapR return r0, r1 } +// OracleClient_MarketMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarketMap' +type OracleClient_MarketMap_Call struct { + *mock.Call +} + +// MarketMap is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryMarketMapRequest +// - opts ...grpc.CallOption +func (_e *OracleClient_Expecter) MarketMap(ctx interface{}, in interface{}, opts ...interface{}) *OracleClient_MarketMap_Call { + return &OracleClient_MarketMap_Call{Call: _e.mock.On("MarketMap", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *OracleClient_MarketMap_Call) Run(run func(ctx context.Context, in *types.QueryMarketMapRequest, opts ...grpc.CallOption)) *OracleClient_MarketMap_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryMarketMapRequest), variadicArgs...) + }) + return _c +} + +func (_c *OracleClient_MarketMap_Call) Return(_a0 *types.QueryMarketMapResponse, _a1 error) *OracleClient_MarketMap_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleClient_MarketMap_Call) RunAndReturn(run func(context.Context, *types.QueryMarketMapRequest, ...grpc.CallOption) (*types.QueryMarketMapResponse, error)) *OracleClient_MarketMap_Call { + _c.Call.Return(run) + return _c +} + // Prices provides a mock function with given fields: ctx, in, opts func (_m *OracleClient) Prices(ctx context.Context, in *types.QueryPricesRequest, opts ...grpc.CallOption) (*types.QueryPricesResponse, error) { _va := make([]interface{}, len(opts)) @@ -91,6 +136,43 @@ func (_m *OracleClient) Prices(ctx context.Context, in *types.QueryPricesRequest return r0, r1 } +// OracleClient_Prices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prices' +type OracleClient_Prices_Call struct { + *mock.Call +} + +// Prices is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryPricesRequest +// - opts ...grpc.CallOption +func (_e *OracleClient_Expecter) Prices(ctx interface{}, in interface{}, opts ...interface{}) *OracleClient_Prices_Call { + return &OracleClient_Prices_Call{Call: _e.mock.On("Prices", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *OracleClient_Prices_Call) Run(run func(ctx context.Context, in *types.QueryPricesRequest, opts ...grpc.CallOption)) *OracleClient_Prices_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryPricesRequest), variadicArgs...) + }) + return _c +} + +func (_c *OracleClient_Prices_Call) Return(_a0 *types.QueryPricesResponse, _a1 error) *OracleClient_Prices_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleClient_Prices_Call) RunAndReturn(run func(context.Context, *types.QueryPricesRequest, ...grpc.CallOption) (*types.QueryPricesResponse, error)) *OracleClient_Prices_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *OracleClient) Start(_a0 context.Context) error { ret := _m.Called(_a0) @@ -109,6 +191,34 @@ func (_m *OracleClient) Start(_a0 context.Context) error { return r0 } +// OracleClient_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type OracleClient_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - _a0 context.Context +func (_e *OracleClient_Expecter) Start(_a0 interface{}) *OracleClient_Start_Call { + return &OracleClient_Start_Call{Call: _e.mock.On("Start", _a0)} +} + +func (_c *OracleClient_Start_Call) Run(run func(_a0 context.Context)) *OracleClient_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *OracleClient_Start_Call) Return(_a0 error) *OracleClient_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleClient_Start_Call) RunAndReturn(run func(context.Context) error) *OracleClient_Start_Call { + _c.Call.Return(run) + return _c +} + // Stop provides a mock function with given fields: func (_m *OracleClient) Stop() error { ret := _m.Called() @@ -127,6 +237,33 @@ func (_m *OracleClient) Stop() error { return r0 } +// OracleClient_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type OracleClient_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *OracleClient_Expecter) Stop() *OracleClient_Stop_Call { + return &OracleClient_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *OracleClient_Stop_Call) Run(run func()) *OracleClient_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *OracleClient_Stop_Call) Return(_a0 error) *OracleClient_Stop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleClient_Stop_Call) RunAndReturn(run func() error) *OracleClient_Stop_Call { + _c.Call.Return(run) + return _c +} + // Version provides a mock function with given fields: ctx, in, opts func (_m *OracleClient) Version(ctx context.Context, in *types.QueryVersionRequest, opts ...grpc.CallOption) (*types.QueryVersionResponse, error) { _va := make([]interface{}, len(opts)) @@ -164,6 +301,43 @@ func (_m *OracleClient) Version(ctx context.Context, in *types.QueryVersionReque return r0, r1 } +// OracleClient_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version' +type OracleClient_Version_Call struct { + *mock.Call +} + +// Version is a helper method to define mock.On call +// - ctx context.Context +// - in *types.QueryVersionRequest +// - opts ...grpc.CallOption +func (_e *OracleClient_Expecter) Version(ctx interface{}, in interface{}, opts ...interface{}) *OracleClient_Version_Call { + return &OracleClient_Version_Call{Call: _e.mock.On("Version", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *OracleClient_Version_Call) Run(run func(ctx context.Context, in *types.QueryVersionRequest, opts ...grpc.CallOption)) *OracleClient_Version_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]grpc.CallOption, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(grpc.CallOption) + } + } + run(args[0].(context.Context), args[1].(*types.QueryVersionRequest), variadicArgs...) + }) + return _c +} + +func (_c *OracleClient_Version_Call) Return(_a0 *types.QueryVersionResponse, _a1 error) *OracleClient_Version_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleClient_Version_Call) RunAndReturn(run func(context.Context, *types.QueryVersionRequest, ...grpc.CallOption) (*types.QueryVersionResponse, error)) *OracleClient_Version_Call { + _c.Call.Return(run) + return _c +} + // NewOracleClient creates a new instance of OracleClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewOracleClient(t interface { diff --git a/service/metrics/mocks/mock_metrics.go b/service/metrics/mocks/mock_metrics.go index 01e8fa719..f3a8d163b 100644 --- a/service/metrics/mocks/mock_metrics.go +++ b/service/metrics/mocks/mock_metrics.go @@ -17,46 +17,286 @@ type Metrics struct { mock.Mock } +type Metrics_Expecter struct { + mock *mock.Mock +} + +func (_m *Metrics) EXPECT() *Metrics_Expecter { + return &Metrics_Expecter{mock: &_m.Mock} +} + // AddABCIRequest provides a mock function with given fields: method, status func (_m *Metrics) AddABCIRequest(method metrics.ABCIMethod, status metrics.Labeller) { _m.Called(method, status) } +// Metrics_AddABCIRequest_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddABCIRequest' +type Metrics_AddABCIRequest_Call struct { + *mock.Call +} + +// AddABCIRequest is a helper method to define mock.On call +// - method metrics.ABCIMethod +// - status metrics.Labeller +func (_e *Metrics_Expecter) AddABCIRequest(method interface{}, status interface{}) *Metrics_AddABCIRequest_Call { + return &Metrics_AddABCIRequest_Call{Call: _e.mock.On("AddABCIRequest", method, status)} +} + +func (_c *Metrics_AddABCIRequest_Call) Run(run func(method metrics.ABCIMethod, status metrics.Labeller)) *Metrics_AddABCIRequest_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.ABCIMethod), args[1].(metrics.Labeller)) + }) + return _c +} + +func (_c *Metrics_AddABCIRequest_Call) Return() *Metrics_AddABCIRequest_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddABCIRequest_Call) RunAndReturn(run func(metrics.ABCIMethod, metrics.Labeller)) *Metrics_AddABCIRequest_Call { + _c.Call.Return(run) + return _c +} + // AddOracleResponse provides a mock function with given fields: status func (_m *Metrics) AddOracleResponse(status metrics.Labeller) { _m.Called(status) } +// Metrics_AddOracleResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddOracleResponse' +type Metrics_AddOracleResponse_Call struct { + *mock.Call +} + +// AddOracleResponse is a helper method to define mock.On call +// - status metrics.Labeller +func (_e *Metrics_Expecter) AddOracleResponse(status interface{}) *Metrics_AddOracleResponse_Call { + return &Metrics_AddOracleResponse_Call{Call: _e.mock.On("AddOracleResponse", status)} +} + +func (_c *Metrics_AddOracleResponse_Call) Run(run func(status metrics.Labeller)) *Metrics_AddOracleResponse_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.Labeller)) + }) + return _c +} + +func (_c *Metrics_AddOracleResponse_Call) Return() *Metrics_AddOracleResponse_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddOracleResponse_Call) RunAndReturn(run func(metrics.Labeller)) *Metrics_AddOracleResponse_Call { + _c.Call.Return(run) + return _c +} + // AddValidatorPriceForTicker provides a mock function with given fields: validator, ticker, price func (_m *Metrics) AddValidatorPriceForTicker(validator string, ticker types.CurrencyPair, price float64) { _m.Called(validator, ticker, price) } +// Metrics_AddValidatorPriceForTicker_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddValidatorPriceForTicker' +type Metrics_AddValidatorPriceForTicker_Call struct { + *mock.Call +} + +// AddValidatorPriceForTicker is a helper method to define mock.On call +// - validator string +// - ticker types.CurrencyPair +// - price float64 +func (_e *Metrics_Expecter) AddValidatorPriceForTicker(validator interface{}, ticker interface{}, price interface{}) *Metrics_AddValidatorPriceForTicker_Call { + return &Metrics_AddValidatorPriceForTicker_Call{Call: _e.mock.On("AddValidatorPriceForTicker", validator, ticker, price)} +} + +func (_c *Metrics_AddValidatorPriceForTicker_Call) Run(run func(validator string, ticker types.CurrencyPair, price float64)) *Metrics_AddValidatorPriceForTicker_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(types.CurrencyPair), args[2].(float64)) + }) + return _c +} + +func (_c *Metrics_AddValidatorPriceForTicker_Call) Return() *Metrics_AddValidatorPriceForTicker_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddValidatorPriceForTicker_Call) RunAndReturn(run func(string, types.CurrencyPair, float64)) *Metrics_AddValidatorPriceForTicker_Call { + _c.Call.Return(run) + return _c +} + // AddValidatorReportForTicker provides a mock function with given fields: validator, ticker, status func (_m *Metrics) AddValidatorReportForTicker(validator string, ticker types.CurrencyPair, status metrics.ReportStatus) { _m.Called(validator, ticker, status) } +// Metrics_AddValidatorReportForTicker_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddValidatorReportForTicker' +type Metrics_AddValidatorReportForTicker_Call struct { + *mock.Call +} + +// AddValidatorReportForTicker is a helper method to define mock.On call +// - validator string +// - ticker types.CurrencyPair +// - status metrics.ReportStatus +func (_e *Metrics_Expecter) AddValidatorReportForTicker(validator interface{}, ticker interface{}, status interface{}) *Metrics_AddValidatorReportForTicker_Call { + return &Metrics_AddValidatorReportForTicker_Call{Call: _e.mock.On("AddValidatorReportForTicker", validator, ticker, status)} +} + +func (_c *Metrics_AddValidatorReportForTicker_Call) Run(run func(validator string, ticker types.CurrencyPair, status metrics.ReportStatus)) *Metrics_AddValidatorReportForTicker_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(types.CurrencyPair), args[2].(metrics.ReportStatus)) + }) + return _c +} + +func (_c *Metrics_AddValidatorReportForTicker_Call) Return() *Metrics_AddValidatorReportForTicker_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_AddValidatorReportForTicker_Call) RunAndReturn(run func(string, types.CurrencyPair, metrics.ReportStatus)) *Metrics_AddValidatorReportForTicker_Call { + _c.Call.Return(run) + return _c +} + // ObserveABCIMethodLatency provides a mock function with given fields: method, duration func (_m *Metrics) ObserveABCIMethodLatency(method metrics.ABCIMethod, duration time.Duration) { _m.Called(method, duration) } +// Metrics_ObserveABCIMethodLatency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObserveABCIMethodLatency' +type Metrics_ObserveABCIMethodLatency_Call struct { + *mock.Call +} + +// ObserveABCIMethodLatency is a helper method to define mock.On call +// - method metrics.ABCIMethod +// - duration time.Duration +func (_e *Metrics_Expecter) ObserveABCIMethodLatency(method interface{}, duration interface{}) *Metrics_ObserveABCIMethodLatency_Call { + return &Metrics_ObserveABCIMethodLatency_Call{Call: _e.mock.On("ObserveABCIMethodLatency", method, duration)} +} + +func (_c *Metrics_ObserveABCIMethodLatency_Call) Run(run func(method metrics.ABCIMethod, duration time.Duration)) *Metrics_ObserveABCIMethodLatency_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.ABCIMethod), args[1].(time.Duration)) + }) + return _c +} + +func (_c *Metrics_ObserveABCIMethodLatency_Call) Return() *Metrics_ObserveABCIMethodLatency_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_ObserveABCIMethodLatency_Call) RunAndReturn(run func(metrics.ABCIMethod, time.Duration)) *Metrics_ObserveABCIMethodLatency_Call { + _c.Call.Return(run) + return _c +} + // ObserveMessageSize provides a mock function with given fields: msg, size func (_m *Metrics) ObserveMessageSize(msg metrics.MessageType, size int) { _m.Called(msg, size) } +// Metrics_ObserveMessageSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObserveMessageSize' +type Metrics_ObserveMessageSize_Call struct { + *mock.Call +} + +// ObserveMessageSize is a helper method to define mock.On call +// - msg metrics.MessageType +// - size int +func (_e *Metrics_Expecter) ObserveMessageSize(msg interface{}, size interface{}) *Metrics_ObserveMessageSize_Call { + return &Metrics_ObserveMessageSize_Call{Call: _e.mock.On("ObserveMessageSize", msg, size)} +} + +func (_c *Metrics_ObserveMessageSize_Call) Run(run func(msg metrics.MessageType, size int)) *Metrics_ObserveMessageSize_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metrics.MessageType), args[1].(int)) + }) + return _c +} + +func (_c *Metrics_ObserveMessageSize_Call) Return() *Metrics_ObserveMessageSize_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_ObserveMessageSize_Call) RunAndReturn(run func(metrics.MessageType, int)) *Metrics_ObserveMessageSize_Call { + _c.Call.Return(run) + return _c +} + // ObserveOracleResponseLatency provides a mock function with given fields: duration func (_m *Metrics) ObserveOracleResponseLatency(duration time.Duration) { _m.Called(duration) } +// Metrics_ObserveOracleResponseLatency_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObserveOracleResponseLatency' +type Metrics_ObserveOracleResponseLatency_Call struct { + *mock.Call +} + +// ObserveOracleResponseLatency is a helper method to define mock.On call +// - duration time.Duration +func (_e *Metrics_Expecter) ObserveOracleResponseLatency(duration interface{}) *Metrics_ObserveOracleResponseLatency_Call { + return &Metrics_ObserveOracleResponseLatency_Call{Call: _e.mock.On("ObserveOracleResponseLatency", duration)} +} + +func (_c *Metrics_ObserveOracleResponseLatency_Call) Run(run func(duration time.Duration)) *Metrics_ObserveOracleResponseLatency_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(time.Duration)) + }) + return _c +} + +func (_c *Metrics_ObserveOracleResponseLatency_Call) Return() *Metrics_ObserveOracleResponseLatency_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_ObserveOracleResponseLatency_Call) RunAndReturn(run func(time.Duration)) *Metrics_ObserveOracleResponseLatency_Call { + _c.Call.Return(run) + return _c +} + // ObservePriceForTicker provides a mock function with given fields: ticker, price func (_m *Metrics) ObservePriceForTicker(ticker types.CurrencyPair, price float64) { _m.Called(ticker, price) } +// Metrics_ObservePriceForTicker_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObservePriceForTicker' +type Metrics_ObservePriceForTicker_Call struct { + *mock.Call +} + +// ObservePriceForTicker is a helper method to define mock.On call +// - ticker types.CurrencyPair +// - price float64 +func (_e *Metrics_Expecter) ObservePriceForTicker(ticker interface{}, price interface{}) *Metrics_ObservePriceForTicker_Call { + return &Metrics_ObservePriceForTicker_Call{Call: _e.mock.On("ObservePriceForTicker", ticker, price)} +} + +func (_c *Metrics_ObservePriceForTicker_Call) Run(run func(ticker types.CurrencyPair, price float64)) *Metrics_ObservePriceForTicker_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.CurrencyPair), args[1].(float64)) + }) + return _c +} + +func (_c *Metrics_ObservePriceForTicker_Call) Return() *Metrics_ObservePriceForTicker_Call { + _c.Call.Return() + return _c +} + +func (_c *Metrics_ObservePriceForTicker_Call) RunAndReturn(run func(types.CurrencyPair, float64)) *Metrics_ObservePriceForTicker_Call { + _c.Call.Return(run) + return _c +} + // NewMetrics creates a new instance of Metrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMetrics(t interface { diff --git a/service/servers/oracle/mocks/mock_oracle_service.go b/service/servers/oracle/mocks/mock_oracle_service.go index 13883f4ea..862599a41 100644 --- a/service/servers/oracle/mocks/mock_oracle_service.go +++ b/service/servers/oracle/mocks/mock_oracle_service.go @@ -15,6 +15,14 @@ type OracleService struct { mock.Mock } +type OracleService_Expecter struct { + mock *mock.Mock +} + +func (_m *OracleService) EXPECT() *OracleService_Expecter { + return &OracleService_Expecter{mock: &_m.Mock} +} + // MarketMap provides a mock function with given fields: _a0, _a1 func (_m *OracleService) MarketMap(_a0 context.Context, _a1 *types.QueryMarketMapRequest) (*types.QueryMarketMapResponse, error) { ret := _m.Called(_a0, _a1) @@ -45,6 +53,35 @@ func (_m *OracleService) MarketMap(_a0 context.Context, _a1 *types.QueryMarketMa return r0, r1 } +// OracleService_MarketMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarketMap' +type OracleService_MarketMap_Call struct { + *mock.Call +} + +// MarketMap is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *types.QueryMarketMapRequest +func (_e *OracleService_Expecter) MarketMap(_a0 interface{}, _a1 interface{}) *OracleService_MarketMap_Call { + return &OracleService_MarketMap_Call{Call: _e.mock.On("MarketMap", _a0, _a1)} +} + +func (_c *OracleService_MarketMap_Call) Run(run func(_a0 context.Context, _a1 *types.QueryMarketMapRequest)) *OracleService_MarketMap_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*types.QueryMarketMapRequest)) + }) + return _c +} + +func (_c *OracleService_MarketMap_Call) Return(_a0 *types.QueryMarketMapResponse, _a1 error) *OracleService_MarketMap_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleService_MarketMap_Call) RunAndReturn(run func(context.Context, *types.QueryMarketMapRequest) (*types.QueryMarketMapResponse, error)) *OracleService_MarketMap_Call { + _c.Call.Return(run) + return _c +} + // Prices provides a mock function with given fields: _a0, _a1 func (_m *OracleService) Prices(_a0 context.Context, _a1 *types.QueryPricesRequest) (*types.QueryPricesResponse, error) { ret := _m.Called(_a0, _a1) @@ -75,6 +112,35 @@ func (_m *OracleService) Prices(_a0 context.Context, _a1 *types.QueryPricesReque return r0, r1 } +// OracleService_Prices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prices' +type OracleService_Prices_Call struct { + *mock.Call +} + +// Prices is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *types.QueryPricesRequest +func (_e *OracleService_Expecter) Prices(_a0 interface{}, _a1 interface{}) *OracleService_Prices_Call { + return &OracleService_Prices_Call{Call: _e.mock.On("Prices", _a0, _a1)} +} + +func (_c *OracleService_Prices_Call) Run(run func(_a0 context.Context, _a1 *types.QueryPricesRequest)) *OracleService_Prices_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*types.QueryPricesRequest)) + }) + return _c +} + +func (_c *OracleService_Prices_Call) Return(_a0 *types.QueryPricesResponse, _a1 error) *OracleService_Prices_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleService_Prices_Call) RunAndReturn(run func(context.Context, *types.QueryPricesRequest) (*types.QueryPricesResponse, error)) *OracleService_Prices_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *OracleService) Start(_a0 context.Context) error { ret := _m.Called(_a0) @@ -93,6 +159,34 @@ func (_m *OracleService) Start(_a0 context.Context) error { return r0 } +// OracleService_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type OracleService_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - _a0 context.Context +func (_e *OracleService_Expecter) Start(_a0 interface{}) *OracleService_Start_Call { + return &OracleService_Start_Call{Call: _e.mock.On("Start", _a0)} +} + +func (_c *OracleService_Start_Call) Run(run func(_a0 context.Context)) *OracleService_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *OracleService_Start_Call) Return(_a0 error) *OracleService_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleService_Start_Call) RunAndReturn(run func(context.Context) error) *OracleService_Start_Call { + _c.Call.Return(run) + return _c +} + // Stop provides a mock function with given fields: _a0 func (_m *OracleService) Stop(_a0 context.Context) error { ret := _m.Called(_a0) @@ -111,6 +205,34 @@ func (_m *OracleService) Stop(_a0 context.Context) error { return r0 } +// OracleService_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type OracleService_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +// - _a0 context.Context +func (_e *OracleService_Expecter) Stop(_a0 interface{}) *OracleService_Stop_Call { + return &OracleService_Stop_Call{Call: _e.mock.On("Stop", _a0)} +} + +func (_c *OracleService_Stop_Call) Run(run func(_a0 context.Context)) *OracleService_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *OracleService_Stop_Call) Return(_a0 error) *OracleService_Stop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *OracleService_Stop_Call) RunAndReturn(run func(context.Context) error) *OracleService_Stop_Call { + _c.Call.Return(run) + return _c +} + // Version provides a mock function with given fields: _a0, _a1 func (_m *OracleService) Version(_a0 context.Context, _a1 *types.QueryVersionRequest) (*types.QueryVersionResponse, error) { ret := _m.Called(_a0, _a1) @@ -141,6 +263,35 @@ func (_m *OracleService) Version(_a0 context.Context, _a1 *types.QueryVersionReq return r0, r1 } +// OracleService_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version' +type OracleService_Version_Call struct { + *mock.Call +} + +// Version is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *types.QueryVersionRequest +func (_e *OracleService_Expecter) Version(_a0 interface{}, _a1 interface{}) *OracleService_Version_Call { + return &OracleService_Version_Call{Call: _e.mock.On("Version", _a0, _a1)} +} + +func (_c *OracleService_Version_Call) Run(run func(_a0 context.Context, _a1 *types.QueryVersionRequest)) *OracleService_Version_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*types.QueryVersionRequest)) + }) + return _c +} + +func (_c *OracleService_Version_Call) Return(_a0 *types.QueryVersionResponse, _a1 error) *OracleService_Version_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *OracleService_Version_Call) RunAndReturn(run func(context.Context, *types.QueryVersionRequest) (*types.QueryVersionResponse, error)) *OracleService_Version_Call { + _c.Call.Return(run) + return _c +} + // NewOracleService creates a new instance of OracleService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewOracleService(t interface { diff --git a/x/marketmap/types/mocks/MarketMapHooks.go b/x/marketmap/types/mocks/MarketMapHooks.go index b24a18d71..fad5ae5d8 100644 --- a/x/marketmap/types/mocks/MarketMapHooks.go +++ b/x/marketmap/types/mocks/MarketMapHooks.go @@ -15,6 +15,14 @@ type MarketMapHooks struct { mock.Mock } +type MarketMapHooks_Expecter struct { + mock *mock.Mock +} + +func (_m *MarketMapHooks) EXPECT() *MarketMapHooks_Expecter { + return &MarketMapHooks_Expecter{mock: &_m.Mock} +} + // AfterMarketCreated provides a mock function with given fields: ctx, market func (_m *MarketMapHooks) AfterMarketCreated(ctx types.Context, market marketmaptypes.Market) error { ret := _m.Called(ctx, market) @@ -33,6 +41,35 @@ func (_m *MarketMapHooks) AfterMarketCreated(ctx types.Context, market marketmap return r0 } +// MarketMapHooks_AfterMarketCreated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AfterMarketCreated' +type MarketMapHooks_AfterMarketCreated_Call struct { + *mock.Call +} + +// AfterMarketCreated is a helper method to define mock.On call +// - ctx types.Context +// - market marketmaptypes.Market +func (_e *MarketMapHooks_Expecter) AfterMarketCreated(ctx interface{}, market interface{}) *MarketMapHooks_AfterMarketCreated_Call { + return &MarketMapHooks_AfterMarketCreated_Call{Call: _e.mock.On("AfterMarketCreated", ctx, market)} +} + +func (_c *MarketMapHooks_AfterMarketCreated_Call) Run(run func(ctx types.Context, market marketmaptypes.Market)) *MarketMapHooks_AfterMarketCreated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(marketmaptypes.Market)) + }) + return _c +} + +func (_c *MarketMapHooks_AfterMarketCreated_Call) Return(_a0 error) *MarketMapHooks_AfterMarketCreated_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MarketMapHooks_AfterMarketCreated_Call) RunAndReturn(run func(types.Context, marketmaptypes.Market) error) *MarketMapHooks_AfterMarketCreated_Call { + _c.Call.Return(run) + return _c +} + // AfterMarketGenesis provides a mock function with given fields: ctx, tickers func (_m *MarketMapHooks) AfterMarketGenesis(ctx types.Context, tickers map[string]marketmaptypes.Market) error { ret := _m.Called(ctx, tickers) @@ -51,6 +88,35 @@ func (_m *MarketMapHooks) AfterMarketGenesis(ctx types.Context, tickers map[stri return r0 } +// MarketMapHooks_AfterMarketGenesis_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AfterMarketGenesis' +type MarketMapHooks_AfterMarketGenesis_Call struct { + *mock.Call +} + +// AfterMarketGenesis is a helper method to define mock.On call +// - ctx types.Context +// - tickers map[string]marketmaptypes.Market +func (_e *MarketMapHooks_Expecter) AfterMarketGenesis(ctx interface{}, tickers interface{}) *MarketMapHooks_AfterMarketGenesis_Call { + return &MarketMapHooks_AfterMarketGenesis_Call{Call: _e.mock.On("AfterMarketGenesis", ctx, tickers)} +} + +func (_c *MarketMapHooks_AfterMarketGenesis_Call) Run(run func(ctx types.Context, tickers map[string]marketmaptypes.Market)) *MarketMapHooks_AfterMarketGenesis_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(map[string]marketmaptypes.Market)) + }) + return _c +} + +func (_c *MarketMapHooks_AfterMarketGenesis_Call) Return(_a0 error) *MarketMapHooks_AfterMarketGenesis_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MarketMapHooks_AfterMarketGenesis_Call) RunAndReturn(run func(types.Context, map[string]marketmaptypes.Market) error) *MarketMapHooks_AfterMarketGenesis_Call { + _c.Call.Return(run) + return _c +} + // AfterMarketUpdated provides a mock function with given fields: ctx, market func (_m *MarketMapHooks) AfterMarketUpdated(ctx types.Context, market marketmaptypes.Market) error { ret := _m.Called(ctx, market) @@ -69,6 +135,35 @@ func (_m *MarketMapHooks) AfterMarketUpdated(ctx types.Context, market marketmap return r0 } +// MarketMapHooks_AfterMarketUpdated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AfterMarketUpdated' +type MarketMapHooks_AfterMarketUpdated_Call struct { + *mock.Call +} + +// AfterMarketUpdated is a helper method to define mock.On call +// - ctx types.Context +// - market marketmaptypes.Market +func (_e *MarketMapHooks_Expecter) AfterMarketUpdated(ctx interface{}, market interface{}) *MarketMapHooks_AfterMarketUpdated_Call { + return &MarketMapHooks_AfterMarketUpdated_Call{Call: _e.mock.On("AfterMarketUpdated", ctx, market)} +} + +func (_c *MarketMapHooks_AfterMarketUpdated_Call) Run(run func(ctx types.Context, market marketmaptypes.Market)) *MarketMapHooks_AfterMarketUpdated_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(marketmaptypes.Market)) + }) + return _c +} + +func (_c *MarketMapHooks_AfterMarketUpdated_Call) Return(_a0 error) *MarketMapHooks_AfterMarketUpdated_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MarketMapHooks_AfterMarketUpdated_Call) RunAndReturn(run func(types.Context, marketmaptypes.Market) error) *MarketMapHooks_AfterMarketUpdated_Call { + _c.Call.Return(run) + return _c +} + // NewMarketMapHooks creates a new instance of MarketMapHooks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMarketMapHooks(t interface { diff --git a/x/oracle/types/mocks/market_map_keeper.go b/x/oracle/types/mocks/market_map_keeper.go index dc7e65bc1..a491640b7 100644 --- a/x/oracle/types/mocks/market_map_keeper.go +++ b/x/oracle/types/mocks/market_map_keeper.go @@ -15,6 +15,14 @@ type MarketMapKeeper struct { mock.Mock } +type MarketMapKeeper_Expecter struct { + mock *mock.Mock +} + +func (_m *MarketMapKeeper) EXPECT() *MarketMapKeeper_Expecter { + return &MarketMapKeeper_Expecter{mock: &_m.Mock} +} + // GetMarket provides a mock function with given fields: ctx, tickerStr func (_m *MarketMapKeeper) GetMarket(ctx types.Context, tickerStr string) (marketmaptypes.Market, error) { ret := _m.Called(ctx, tickerStr) @@ -43,6 +51,35 @@ func (_m *MarketMapKeeper) GetMarket(ctx types.Context, tickerStr string) (marke return r0, r1 } +// MarketMapKeeper_GetMarket_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMarket' +type MarketMapKeeper_GetMarket_Call struct { + *mock.Call +} + +// GetMarket is a helper method to define mock.On call +// - ctx types.Context +// - tickerStr string +func (_e *MarketMapKeeper_Expecter) GetMarket(ctx interface{}, tickerStr interface{}) *MarketMapKeeper_GetMarket_Call { + return &MarketMapKeeper_GetMarket_Call{Call: _e.mock.On("GetMarket", ctx, tickerStr)} +} + +func (_c *MarketMapKeeper_GetMarket_Call) Run(run func(ctx types.Context, tickerStr string)) *MarketMapKeeper_GetMarket_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.Context), args[1].(string)) + }) + return _c +} + +func (_c *MarketMapKeeper_GetMarket_Call) Return(_a0 marketmaptypes.Market, _a1 error) *MarketMapKeeper_GetMarket_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MarketMapKeeper_GetMarket_Call) RunAndReturn(run func(types.Context, string) (marketmaptypes.Market, error)) *MarketMapKeeper_GetMarket_Call { + _c.Call.Return(run) + return _c +} + // NewMarketMapKeeper creates a new instance of MarketMapKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMarketMapKeeper(t interface {