From 6a227d0be6596ebee81b49e5b09d538e342244f0 Mon Sep 17 00:00:00 2001 From: alexey semenyuk Date: Sun, 19 May 2024 11:11:00 +0500 Subject: [PATCH 1/2] Update mockery version Signed-off-by: alexey semenyuk --- Makefile | 4 +- mocks/apiclientmocks/fftm_client.go | 2 +- mocks/confirmationsmocks/manager.go | 41 +------------------ mocks/eventsmocks/stream.go | 2 +- mocks/ffcapimocks/api.go | 2 +- .../transaction_handler_metrics.go | 2 +- mocks/persistencemocks/persistence.go | 12 +++--- mocks/persistencemocks/rich_query.go | 2 +- .../transaction_persistence.go | 2 +- .../managed_tx_event_handler.go | 2 +- mocks/txhandlermocks/transaction_handler.go | 2 +- mocks/wsmocks/web_socket_channels.go | 2 +- mocks/wsmocks/web_socket_server.go | 2 +- 13 files changed, 19 insertions(+), 58 deletions(-) diff --git a/Makefile b/Makefile index bf9930e7..d0adc970 100644 --- a/Makefile +++ b/Makefile @@ -16,12 +16,12 @@ test: deps lint coverage.html: $(VGO) tool cover -html=coverage.txt coverage: test coverage.html -lint: +lint: $(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 GOGC=20 $(LINT) run -v --timeout 5m ${MOCKERY}: - $(VGO) install github.com/vektra/mockery/v2@latest + $(VGO) install github.com/vektra/mockery/v2@v2.43.1 define makemock mocks: mocks-$(strip $(1))-$(strip $(2)) diff --git a/mocks/apiclientmocks/fftm_client.go b/mocks/apiclientmocks/fftm_client.go index 593aaa44..82b677c1 100644 --- a/mocks/apiclientmocks/fftm_client.go +++ b/mocks/apiclientmocks/fftm_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package apiclientmocks diff --git a/mocks/confirmationsmocks/manager.go b/mocks/confirmationsmocks/manager.go index ea170362..25a5e21e 100644 --- a/mocks/confirmationsmocks/manager.go +++ b/mocks/confirmationsmocks/manager.go @@ -1,12 +1,9 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package confirmationsmocks import ( - context "context" - confirmations "github.com/hyperledger/firefly-transaction-manager/internal/confirmations" - ffcapi "github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi" fftypes "github.com/hyperledger/firefly-common/pkg/fftypes" @@ -80,47 +77,11 @@ func (_m *Manager) Start() { _m.Called() } -// StartConfirmedBlockListener provides a mock function with given fields: ctx, id, fromBlock, checkpoint, eventStream -func (_m *Manager) StartConfirmedBlockListener(ctx context.Context, id *fftypes.UUID, fromBlock string, checkpoint *ffcapi.BlockListenerCheckpoint, eventStream chan<- *ffcapi.ListenerEvent) error { - ret := _m.Called(ctx, id, fromBlock, checkpoint, eventStream) - - if len(ret) == 0 { - panic("no return value specified for StartConfirmedBlockListener") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID, string, *ffcapi.BlockListenerCheckpoint, chan<- *ffcapi.ListenerEvent) error); ok { - r0 = rf(ctx, id, fromBlock, checkpoint, eventStream) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // Stop provides a mock function with given fields: func (_m *Manager) Stop() { _m.Called() } -// StopConfirmedBlockListener provides a mock function with given fields: ctx, id -func (_m *Manager) StopConfirmedBlockListener(ctx context.Context, id *fftypes.UUID) error { - ret := _m.Called(ctx, id) - - if len(ret) == 0 { - panic("no return value specified for StopConfirmedBlockListener") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID) error); ok { - r0 = rf(ctx, id) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // NewManager creates a new instance of Manager. 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 NewManager(t interface { diff --git a/mocks/eventsmocks/stream.go b/mocks/eventsmocks/stream.go index 7987f17f..3b162f29 100644 --- a/mocks/eventsmocks/stream.go +++ b/mocks/eventsmocks/stream.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package eventsmocks diff --git a/mocks/ffcapimocks/api.go b/mocks/ffcapimocks/api.go index 3c48878a..767123b8 100644 --- a/mocks/ffcapimocks/api.go +++ b/mocks/ffcapimocks/api.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package ffcapimocks diff --git a/mocks/metricsmocks/transaction_handler_metrics.go b/mocks/metricsmocks/transaction_handler_metrics.go index f5cb5818..863b0763 100644 --- a/mocks/metricsmocks/transaction_handler_metrics.go +++ b/mocks/metricsmocks/transaction_handler_metrics.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package metricsmocks diff --git a/mocks/persistencemocks/persistence.go b/mocks/persistencemocks/persistence.go index a0ca43fd..bfc37775 100644 --- a/mocks/persistencemocks/persistence.go +++ b/mocks/persistencemocks/persistence.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package persistencemocks @@ -23,17 +23,17 @@ type Persistence struct { mock.Mock } -// AddSubStatusAction provides a mock function with given fields: ctx, txID, subStatus, action, info, err, actionOccurred -func (_m *Persistence) AddSubStatusAction(ctx context.Context, txID string, subStatus apitypes.TxSubStatus, action apitypes.TxAction, info *fftypes.JSONAny, err *fftypes.JSONAny, actionOccurred *fftypes.FFTime) error { - ret := _m.Called(ctx, txID, subStatus, action, info, err, actionOccurred) +// AddSubStatusAction provides a mock function with given fields: ctx, txID, subStatus, action, info, err +func (_m *Persistence) AddSubStatusAction(ctx context.Context, txID string, subStatus apitypes.TxSubStatus, action apitypes.TxAction, info *fftypes.JSONAny, err *fftypes.JSONAny) error { + ret := _m.Called(ctx, txID, subStatus, action, info, err) if len(ret) == 0 { panic("no return value specified for AddSubStatusAction") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, apitypes.TxSubStatus, apitypes.TxAction, *fftypes.JSONAny, *fftypes.JSONAny, *fftypes.FFTime) error); ok { - r0 = rf(ctx, txID, subStatus, action, info, err, actionOccurred) + if rf, ok := ret.Get(0).(func(context.Context, string, apitypes.TxSubStatus, apitypes.TxAction, *fftypes.JSONAny, *fftypes.JSONAny) error); ok { + r0 = rf(ctx, txID, subStatus, action, info, err) } else { r0 = ret.Error(0) } diff --git a/mocks/persistencemocks/rich_query.go b/mocks/persistencemocks/rich_query.go index f28cb57d..9b0b34c2 100644 --- a/mocks/persistencemocks/rich_query.go +++ b/mocks/persistencemocks/rich_query.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package persistencemocks diff --git a/mocks/persistencemocks/transaction_persistence.go b/mocks/persistencemocks/transaction_persistence.go index 3f65203e..21ca5d0d 100644 --- a/mocks/persistencemocks/transaction_persistence.go +++ b/mocks/persistencemocks/transaction_persistence.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package persistencemocks diff --git a/mocks/txhandlermocks/managed_tx_event_handler.go b/mocks/txhandlermocks/managed_tx_event_handler.go index 2074fcbc..9736dc9b 100644 --- a/mocks/txhandlermocks/managed_tx_event_handler.go +++ b/mocks/txhandlermocks/managed_tx_event_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package txhandlermocks diff --git a/mocks/txhandlermocks/transaction_handler.go b/mocks/txhandlermocks/transaction_handler.go index e7aabd69..6f57c740 100644 --- a/mocks/txhandlermocks/transaction_handler.go +++ b/mocks/txhandlermocks/transaction_handler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package txhandlermocks diff --git a/mocks/wsmocks/web_socket_channels.go b/mocks/wsmocks/web_socket_channels.go index ff0c66c9..9786560a 100644 --- a/mocks/wsmocks/web_socket_channels.go +++ b/mocks/wsmocks/web_socket_channels.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package wsmocks diff --git a/mocks/wsmocks/web_socket_server.go b/mocks/wsmocks/web_socket_server.go index eca59b48..2f1f34d6 100644 --- a/mocks/wsmocks/web_socket_server.go +++ b/mocks/wsmocks/web_socket_server.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package wsmocks From 573f26dd8f9ad37e0b416b2da2d1064f777a9e4d Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Sun, 21 Jul 2024 01:29:42 +0500 Subject: [PATCH 2/2] Update mockery version Signed-off-by: alexey semenyuk --- Makefile | 2 +- mocks/confirmationsmocks/manager.go | 39 +++++++++++++++++++++ mocks/metricsmocks/event_metrics_emitter.go | 2 +- mocks/persistencemocks/persistence.go | 10 +++--- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d0adc970..40bbc938 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ test: deps lint coverage.html: $(VGO) tool cover -html=coverage.txt coverage: test coverage.html -lint: +lint: $(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 GOGC=20 $(LINT) run -v --timeout 5m diff --git a/mocks/confirmationsmocks/manager.go b/mocks/confirmationsmocks/manager.go index 25a5e21e..f66ee78a 100644 --- a/mocks/confirmationsmocks/manager.go +++ b/mocks/confirmationsmocks/manager.go @@ -3,7 +3,10 @@ package confirmationsmocks import ( + context "context" + confirmations "github.com/hyperledger/firefly-transaction-manager/internal/confirmations" + ffcapi "github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi" fftypes "github.com/hyperledger/firefly-common/pkg/fftypes" @@ -77,11 +80,47 @@ func (_m *Manager) Start() { _m.Called() } +// StartConfirmedBlockListener provides a mock function with given fields: ctx, id, fromBlock, checkpoint, eventStream +func (_m *Manager) StartConfirmedBlockListener(ctx context.Context, id *fftypes.UUID, fromBlock string, checkpoint *ffcapi.BlockListenerCheckpoint, eventStream chan<- *ffcapi.ListenerEvent) error { + ret := _m.Called(ctx, id, fromBlock, checkpoint, eventStream) + + if len(ret) == 0 { + panic("no return value specified for StartConfirmedBlockListener") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID, string, *ffcapi.BlockListenerCheckpoint, chan<- *ffcapi.ListenerEvent) error); ok { + r0 = rf(ctx, id, fromBlock, checkpoint, eventStream) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // Stop provides a mock function with given fields: func (_m *Manager) Stop() { _m.Called() } +// StopConfirmedBlockListener provides a mock function with given fields: ctx, id +func (_m *Manager) StopConfirmedBlockListener(ctx context.Context, id *fftypes.UUID) error { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for StopConfirmedBlockListener") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, *fftypes.UUID) error); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // NewManager creates a new instance of Manager. 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 NewManager(t interface { diff --git a/mocks/metricsmocks/event_metrics_emitter.go b/mocks/metricsmocks/event_metrics_emitter.go index 443b9e58..45ac88e1 100644 --- a/mocks/metricsmocks/event_metrics_emitter.go +++ b/mocks/metricsmocks/event_metrics_emitter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.2. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package metricsmocks diff --git a/mocks/persistencemocks/persistence.go b/mocks/persistencemocks/persistence.go index bfc37775..42e68796 100644 --- a/mocks/persistencemocks/persistence.go +++ b/mocks/persistencemocks/persistence.go @@ -23,17 +23,17 @@ type Persistence struct { mock.Mock } -// AddSubStatusAction provides a mock function with given fields: ctx, txID, subStatus, action, info, err -func (_m *Persistence) AddSubStatusAction(ctx context.Context, txID string, subStatus apitypes.TxSubStatus, action apitypes.TxAction, info *fftypes.JSONAny, err *fftypes.JSONAny) error { - ret := _m.Called(ctx, txID, subStatus, action, info, err) +// AddSubStatusAction provides a mock function with given fields: ctx, txID, subStatus, action, info, err, actionOccurred +func (_m *Persistence) AddSubStatusAction(ctx context.Context, txID string, subStatus apitypes.TxSubStatus, action apitypes.TxAction, info *fftypes.JSONAny, err *fftypes.JSONAny, actionOccurred *fftypes.FFTime) error { + ret := _m.Called(ctx, txID, subStatus, action, info, err, actionOccurred) if len(ret) == 0 { panic("no return value specified for AddSubStatusAction") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, apitypes.TxSubStatus, apitypes.TxAction, *fftypes.JSONAny, *fftypes.JSONAny) error); ok { - r0 = rf(ctx, txID, subStatus, action, info, err) + if rf, ok := ret.Get(0).(func(context.Context, string, apitypes.TxSubStatus, apitypes.TxAction, *fftypes.JSONAny, *fftypes.JSONAny, *fftypes.FFTime) error); ok { + r0 = rf(ctx, txID, subStatus, action, info, err, actionOccurred) } else { r0 = ret.Error(0) }