From 359662318d9d20072a93ae9b7d2916e3a1893ce6 Mon Sep 17 00:00:00 2001 From: Ketsia Date: Tue, 23 Apr 2024 19:14:39 +0200 Subject: [PATCH 1/2] generate resource mock and add tests for HandleDecisionTaskCompleted --- service/history/decision/handler_test.go | 206 ++++++- service/history/resource/resource.go | 2 + service/history/resource/resource_mock.go | 667 ++++++++++++++++++++++ 3 files changed, 853 insertions(+), 22 deletions(-) create mode 100644 service/history/resource/resource_mock.go diff --git a/service/history/decision/handler_test.go b/service/history/decision/handler_test.go index f93b26c2b4a..a2cda374c53 100644 --- a/service/history/decision/handler_test.go +++ b/service/history/decision/handler_test.go @@ -37,8 +37,10 @@ import ( "github.com/uber/cadence/common" "github.com/uber/cadence/common/cache" + "github.com/uber/cadence/common/checksum" "github.com/uber/cadence/common/client" "github.com/uber/cadence/common/clock" + "github.com/uber/cadence/common/dynamicconfig" "github.com/uber/cadence/common/log/loggerimpl" "github.com/uber/cadence/common/log/testlogger" "github.com/uber/cadence/common/metrics" @@ -241,8 +243,9 @@ func TestHandleDecisionTaskScheduled(t *testing.T) { logger: testlogger.New(t), versionChecker: client.NewVersionChecker(), tokenSerializer: common.NewMockTaskTokenSerializer(ctrl), + domainCache: cache.NewMockDomainCache(ctrl), } - expectCommonCalls(t, decisionHandler, test.domainID, test.mutablestate) + expectCommonCalls(decisionHandler, test.domainID, test.mutablestate) if test.expectCalls != nil { test.expectCalls(ctrl, decisionHandler.shard.(*shard.MockContext)) } @@ -375,8 +378,9 @@ func TestHandleDecisionTaskFailed(t *testing.T) { logger: testlogger.New(t), versionChecker: client.NewVersionChecker(), tokenSerializer: common.NewMockTaskTokenSerializer(ctrl), + domainCache: cache.NewMockDomainCache(ctrl), } - expectCommonCalls(t, decisionHandler, test.domainID, test.mutablestate) + expectCommonCalls(decisionHandler, test.domainID, test.mutablestate) decisionHandler.executionCache = execution.NewCache(shardContext) if test.expectCalls != nil { test.expectCalls(ctrl, decisionHandler) @@ -539,8 +543,9 @@ func TestHandleDecisionTaskStarted(t *testing.T) { metricsClient: metrics.NewClient(tally.NoopScope, metrics.History), logger: testlogger.New(t), versionChecker: client.NewVersionChecker(), + domainCache: cache.NewMockDomainCache(ctrl), } - expectCommonCalls(t, decisionHandler, test.domainID, test.mutablestate) + expectCommonCalls(decisionHandler, test.domainID, test.mutablestate) decisionHandler.executionCache = execution.NewCache(shardContext) if test.expectCalls != nil { test.expectCalls(ctrl, decisionHandler) @@ -560,6 +565,159 @@ func TestHandleDecisionTaskStarted(t *testing.T) { } } +func TestHandleDecisionTaskCompleted(t *testing.T) { + _serializedTestToken := []byte("test-token") + _testTaskListName := "some-tasklist-name" + _testWorkflowTypeName := "some-workflow-type-name" + tests := []struct { + name string + domainID string + expectedErr error + expectMockCalls func(ctrl *gomock.Controller, decisionHandler *handlerImpl) + assertResponseBody func(t *testing.T, resp *types.HistoryRespondDecisionTaskCompletedResponse) + mutableState *persistence.WorkflowMutableState + }{ + { + name: "failure to get domain from ID", + domainID: _testInvalidDomainUUID, + expectedErr: &types.BadRequestError{Message: "Invalid domain UUID."}, + }, + { + name: "token deserialazation failure", + domainID: constants.TestDomainID, + expectedErr: workflow.ErrDeserializingToken, + expectMockCalls: func(ctrl *gomock.Controller, decisionHandler *handlerImpl) { + decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(_serializedTestToken).Return(nil, errors.New("unable to deserialize task token")) + }, + }, + { + name: "get or create wf execution failure", + domainID: constants.TestDomainID, + expectedErr: &types.BadRequestError{Message: "Can't load workflow execution. WorkflowId not set."}, + expectMockCalls: func(ctrl *gomock.Controller, decisionHandler *handlerImpl) { + _taskToken := &common.TaskToken{ + DomainID: constants.TestDomainID, + // empty workflow ID to force decisionHandler.executionCache.GetOrCreateWorkflowExecution() failure + } + decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(_serializedTestToken).Return(_taskToken, nil) + }, + }, + { + name: "success", + domainID: constants.TestDomainID, + expectedErr: nil, + expectMockCalls: func(ctrl *gomock.Controller, decisionHandler *handlerImpl) { + _deserializedTestToken := &common.TaskToken{ + DomainID: constants.TestDomainID, + WorkflowID: constants.TestWorkflowID, + RunID: constants.TestRunID, + ScheduleID: 0, + } + decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(_serializedTestToken).Return(_deserializedTestToken, nil) + decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Serialize(gomock.Any()).Return(_serializedTestToken, nil) + + eventsCache := events.NewMockCache(ctrl) + decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(eventsCache) + eventsCache.EXPECT().PutEvent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) + decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(_testShardID) + decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(gomock.Any()).Times(2).Return([]int64{0, 1, 2, 3, 4, 5}, nil) + decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{ + WorkflowID: constants.TestWorkflowID, + RunID: constants.TestRunID, + }).Return(&persistence.AppendHistoryNodesResponse{}, nil) + decisionHandler.shard.(*shard.MockContext).EXPECT().UpdateWorkflowExecution(gomock.Any(), gomock.Any()).Return(&persistence.UpdateWorkflowExecutionResponse{}, nil) + + engine := engine.NewMockEngine(ctrl) + decisionHandler.shard.(*shard.MockContext).EXPECT().GetEngine().Return(engine).Times(3) + engine.EXPECT().NotifyNewHistoryEvent(gomock.Any()) + engine.EXPECT().NotifyNewTransferTasks(gomock.Any()) + engine.EXPECT().NotifyNewTimerTasks(gomock.Any()) + engine.EXPECT().NotifyNewCrossClusterTasks(gomock.Any()) + engine.EXPECT().NotifyNewReplicationTasks(gomock.Any()) + + decisionHandler.domainCache.(*cache.MockDomainCache).EXPECT().GetDomain(constants.TestDomainName).Times(1).Return(constants.TestLocalDomainEntry, nil) + decisionHandler.domainCache.(*cache.MockDomainCache).EXPECT().GetDomainID(constants.TestDomainName).Times(1).Return(constants.TestDomainID, nil) + }, + mutableState: &persistence.WorkflowMutableState{ + ExecutionInfo: &persistence.WorkflowExecutionInfo{ + WorkflowTimeout: 600, + AutoResetPoints: &types.ResetPoints{ + Points: func() []*types.ResetPointInfo { + if historyMaxResetPoints, ok := dynamicconfig.IntKeys[dynamicconfig.HistoryMaxAutoResetPoints]; ok { + return make([]*types.ResetPointInfo, historyMaxResetPoints.DefaultValue) + } + return []*types.ResetPointInfo{} + }(), + }, + WorkflowTypeName: _testWorkflowTypeName, + TaskList: _testTaskListName, + }, + Checksum: checksum.Checksum{}, + BufferedEvents: append([]*types.HistoryEvent{}, &types.HistoryEvent{}), + ActivityInfos: make(map[int64]*persistence.ActivityInfo), + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + ctrl := gomock.NewController(t) + shard := shard.NewMockContext(ctrl) + handlerConfig := config.NewForTest() + handlerConfig.MaxActivityCountDispatchByDomain = func(domain string) int { return 1 } // some value > 0 + handlerConfig.EnableActivityLocalDispatchByDomain = func(domain string) bool { return true } + decisionHandler := &handlerImpl{ + config: handlerConfig, + shard: shard, + timeSource: clock.NewMockedTimeSource(), + domainCache: cache.NewMockDomainCache(ctrl), + metricsClient: metrics.NewClient(tally.NoopScope, metrics.History), + logger: testlogger.New(t), + versionChecker: client.NewVersionChecker(), + tokenSerializer: common.NewMockTaskTokenSerializer(ctrl), + attrValidator: newAttrValidator(cache.NewMockDomainCache(ctrl), metrics.NewClient(tally.NoopScope, metrics.History), config.NewForTest(), testlogger.New(t)), + } + expectCommonCalls(decisionHandler, test.domainID, test.mutableState) + decisionHandler.executionCache = execution.NewCache(shard) + + request := &types.HistoryRespondDecisionTaskCompletedRequest{ + DomainUUID: test.domainID, + CompleteRequest: &types.RespondDecisionTaskCompletedRequest{ + TaskToken: _serializedTestToken, + Decisions: []*types.Decision{{ + DecisionType: nil, + ScheduleActivityTaskDecisionAttributes: &types.ScheduleActivityTaskDecisionAttributes{ + ActivityID: "some-activity-id", + ActivityType: &types.ActivityType{Name: "some-activity-name"}, + Domain: constants.TestDomainName, + TaskList: &types.TaskList{Name: _testTaskListName}, + ScheduleToCloseTimeoutSeconds: func(i int32) *int32 { return &i }(200), + ScheduleToStartTimeoutSeconds: func(i int32) *int32 { return &i }(100), + StartToCloseTimeoutSeconds: func(i int32) *int32 { return &i }(100), + RequestLocalDispatch: true, + }, + }}, + ReturnNewDecisionTask: true, + }, + } + if test.expectMockCalls != nil { + test.expectMockCalls(ctrl, decisionHandler) + } + resp, err := decisionHandler.HandleDecisionTaskCompleted(context.Background(), request) + assert.Equal(t, test.expectedErr, err) + if err != nil { + assert.Nil(t, resp) + } else { + assert.True(t, resp.StartedResponse.StickyExecutionEnabled) + assert.Equal(t, 1, len(resp.ActivitiesToDispatchLocally)) + assert.Equal(t, _testWorkflowTypeName, resp.StartedResponse.WorkflowType.Name) + assert.Equal(t, int64(0), resp.StartedResponse.Attempt) + assert.Equal(t, _testTaskListName, resp.StartedResponse.WorkflowExecutionTaskList.Name) + } + }) + } +} + func (s *DecisionHandlerSuite) TestCreateRecordDecisionTaskStartedResponse() { tests := []struct { name string @@ -771,29 +929,33 @@ func (s *DecisionHandlerSuite) assertQueryCounts(queryRegistry query.Registry, b s.Len(queryRegistry.GetFailedIDs(), failed) } -func expectCommonCalls(t *testing.T, handler *handlerImpl, domainID string, state *persistence.WorkflowMutableState) { +func expectCommonCalls(handler *handlerImpl, domainID string, state *persistence.WorkflowMutableState) { workflowExecutionResponse := &persistence.GetWorkflowExecutionResponse{ State: state, MutableStateStats: &persistence.MutableStateStats{}, } - workflowExecutionResponse.State.ExecutionStats = &persistence.ExecutionStats{} - workflowExecutionResponse.State.ExecutionInfo.DomainID = domainID - workflowExecutionResponse.State.ExecutionInfo.WorkflowID = constants.TestWorkflowID - workflowExecutionResponse.State.ExecutionInfo.RunID = constants.TestRunID - shardContextConfig := config.NewForTest() - shardContextLogger := testlogger.New(t) - shardContextTimeSource := clock.NewMockedTimeSource() - shardContextMetricClient := metrics.NewClient(tally.NoopScope, metrics.History) - domainCacheMock := cache.NewMockDomainCache(gomock.NewController(t)) - - handler.shard.(*shard.MockContext).EXPECT().GetWorkflowExecution(gomock.Any(), gomock.Any()).AnyTimes().Return(workflowExecutionResponse, nil) - handler.shard.(*shard.MockContext).EXPECT().GetConfig().AnyTimes().Return(shardContextConfig) - handler.shard.(*shard.MockContext).EXPECT().GetLogger().AnyTimes().Return(shardContextLogger) - handler.shard.(*shard.MockContext).EXPECT().GetTimeSource().AnyTimes().Return(shardContextTimeSource) - handler.shard.(*shard.MockContext).EXPECT().GetDomainCache().AnyTimes().Return(domainCacheMock) + if state != nil { + workflowExecutionResponse.State.ExecutionStats = &persistence.ExecutionStats{} + workflowExecutionResponse.State.ExecutionInfo.DomainID = domainID + workflowExecutionResponse.State.ExecutionInfo.WorkflowID = constants.TestWorkflowID + workflowExecutionResponse.State.ExecutionInfo.RunID = constants.TestRunID + } + + handler.shard.(*shard.MockContext).EXPECT().GetWorkflowExecution(context.Background(), &persistence.GetWorkflowExecutionRequest{ + DomainID: domainID, + DomainName: constants.TestDomainName, + Execution: types.WorkflowExecution{ + WorkflowID: constants.TestWorkflowID, + RunID: constants.TestRunID, + }, + }).AnyTimes().Return(workflowExecutionResponse, nil) + handler.shard.(*shard.MockContext).EXPECT().GetConfig().AnyTimes().Return(handler.config) + handler.shard.(*shard.MockContext).EXPECT().GetLogger().AnyTimes().Return(handler.logger) + handler.shard.(*shard.MockContext).EXPECT().GetTimeSource().AnyTimes().Return(handler.timeSource) + handler.shard.(*shard.MockContext).EXPECT().GetDomainCache().AnyTimes().Return(handler.domainCache) handler.shard.(*shard.MockContext).EXPECT().GetClusterMetadata().AnyTimes().Return(constants.TestClusterMetadata) - handler.shard.(*shard.MockContext).EXPECT().GetMetricsClient().AnyTimes().Return(shardContextMetricClient) - domainCacheMock.EXPECT().GetDomainByID(domainID).AnyTimes().Return(constants.TestLocalDomainEntry, nil) - domainCacheMock.EXPECT().GetDomainName(domainID).AnyTimes().Return(constants.TestDomainName, nil) + handler.shard.(*shard.MockContext).EXPECT().GetMetricsClient().AnyTimes().Return(handler.metricsClient) + handler.domainCache.(*cache.MockDomainCache).EXPECT().GetDomainByID(domainID).AnyTimes().Return(constants.TestLocalDomainEntry, nil) + handler.domainCache.(*cache.MockDomainCache).EXPECT().GetDomainName(domainID).AnyTimes().Return(constants.TestDomainName, nil) handler.shard.(*shard.MockContext).EXPECT().GetExecutionManager().Times(1) } diff --git a/service/history/resource/resource.go b/service/history/resource/resource.go index b9f59a501fe..08548972ff3 100644 --- a/service/history/resource/resource.go +++ b/service/history/resource/resource.go @@ -18,6 +18,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination resource_mock.go -self_package github.com/uber/cadence/service/history/resource + package resource import ( diff --git a/service/history/resource/resource_mock.go b/service/history/resource/resource_mock.go new file mode 100644 index 00000000000..4398ef3fdba --- /dev/null +++ b/service/history/resource/resource_mock.go @@ -0,0 +1,667 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +// Code generated by MockGen. DO NOT EDIT. +// Source: resource.go + +// Package resource is a generated GoMock package. +package resource + +import ( + reflect "reflect" + + gomock "github.com/golang/mock/gomock" + workflowserviceclient "go.uber.org/cadence/.gen/go/cadence/workflowserviceclient" + yarpc "go.uber.org/yarpc" + + client "github.com/uber/cadence/client" + admin "github.com/uber/cadence/client/admin" + frontend "github.com/uber/cadence/client/frontend" + history "github.com/uber/cadence/client/history" + matching "github.com/uber/cadence/client/matching" + archiver "github.com/uber/cadence/common/archiver" + provider "github.com/uber/cadence/common/archiver/provider" + queue "github.com/uber/cadence/common/asyncworkflow/queue" + blobstore "github.com/uber/cadence/common/blobstore" + cache "github.com/uber/cadence/common/cache" + clock "github.com/uber/cadence/common/clock" + cluster "github.com/uber/cadence/common/cluster" + domain "github.com/uber/cadence/common/domain" + configstore "github.com/uber/cadence/common/dynamicconfig/configstore" + isolationgroup "github.com/uber/cadence/common/isolationgroup" + log "github.com/uber/cadence/common/log" + membership "github.com/uber/cadence/common/membership" + messaging "github.com/uber/cadence/common/messaging" + metrics "github.com/uber/cadence/common/metrics" + partition "github.com/uber/cadence/common/partition" + persistence "github.com/uber/cadence/common/persistence" + client0 "github.com/uber/cadence/common/persistence/client" + events "github.com/uber/cadence/service/history/events" +) + +// MockResource is a mock of Resource interface. +type MockResource struct { + ctrl *gomock.Controller + recorder *MockResourceMockRecorder +} + +// MockResourceMockRecorder is the mock recorder for MockResource. +type MockResourceMockRecorder struct { + mock *MockResource +} + +// NewMockResource creates a new mock instance. +func NewMockResource(ctrl *gomock.Controller) *MockResource { + mock := &MockResource{ctrl: ctrl} + mock.recorder = &MockResourceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockResource) EXPECT() *MockResourceMockRecorder { + return m.recorder +} + +// GetArchivalMetadata mocks base method. +func (m *MockResource) GetArchivalMetadata() archiver.ArchivalMetadata { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetArchivalMetadata") + ret0, _ := ret[0].(archiver.ArchivalMetadata) + return ret0 +} + +// GetArchivalMetadata indicates an expected call of GetArchivalMetadata. +func (mr *MockResourceMockRecorder) GetArchivalMetadata() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetArchivalMetadata", reflect.TypeOf((*MockResource)(nil).GetArchivalMetadata)) +} + +// GetArchiverProvider mocks base method. +func (m *MockResource) GetArchiverProvider() provider.ArchiverProvider { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetArchiverProvider") + ret0, _ := ret[0].(provider.ArchiverProvider) + return ret0 +} + +// GetArchiverProvider indicates an expected call of GetArchiverProvider. +func (mr *MockResourceMockRecorder) GetArchiverProvider() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetArchiverProvider", reflect.TypeOf((*MockResource)(nil).GetArchiverProvider)) +} + +// GetAsyncWorkflowQueueProvider mocks base method. +func (m *MockResource) GetAsyncWorkflowQueueProvider() queue.Provider { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAsyncWorkflowQueueProvider") + ret0, _ := ret[0].(queue.Provider) + return ret0 +} + +// GetAsyncWorkflowQueueProvider indicates an expected call of GetAsyncWorkflowQueueProvider. +func (mr *MockResourceMockRecorder) GetAsyncWorkflowQueueProvider() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAsyncWorkflowQueueProvider", reflect.TypeOf((*MockResource)(nil).GetAsyncWorkflowQueueProvider)) +} + +// GetBlobstoreClient mocks base method. +func (m *MockResource) GetBlobstoreClient() blobstore.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBlobstoreClient") + ret0, _ := ret[0].(blobstore.Client) + return ret0 +} + +// GetBlobstoreClient indicates an expected call of GetBlobstoreClient. +func (mr *MockResourceMockRecorder) GetBlobstoreClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlobstoreClient", reflect.TypeOf((*MockResource)(nil).GetBlobstoreClient)) +} + +// GetClientBean mocks base method. +func (m *MockResource) GetClientBean() client.Bean { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClientBean") + ret0, _ := ret[0].(client.Bean) + return ret0 +} + +// GetClientBean indicates an expected call of GetClientBean. +func (mr *MockResourceMockRecorder) GetClientBean() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClientBean", reflect.TypeOf((*MockResource)(nil).GetClientBean)) +} + +// GetClusterMetadata mocks base method. +func (m *MockResource) GetClusterMetadata() cluster.Metadata { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClusterMetadata") + ret0, _ := ret[0].(cluster.Metadata) + return ret0 +} + +// GetClusterMetadata indicates an expected call of GetClusterMetadata. +func (mr *MockResourceMockRecorder) GetClusterMetadata() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClusterMetadata", reflect.TypeOf((*MockResource)(nil).GetClusterMetadata)) +} + +// GetDispatcher mocks base method. +func (m *MockResource) GetDispatcher() *yarpc.Dispatcher { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDispatcher") + ret0, _ := ret[0].(*yarpc.Dispatcher) + return ret0 +} + +// GetDispatcher indicates an expected call of GetDispatcher. +func (mr *MockResourceMockRecorder) GetDispatcher() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDispatcher", reflect.TypeOf((*MockResource)(nil).GetDispatcher)) +} + +// GetDomainCache mocks base method. +func (m *MockResource) GetDomainCache() cache.DomainCache { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDomainCache") + ret0, _ := ret[0].(cache.DomainCache) + return ret0 +} + +// GetDomainCache indicates an expected call of GetDomainCache. +func (mr *MockResourceMockRecorder) GetDomainCache() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomainCache", reflect.TypeOf((*MockResource)(nil).GetDomainCache)) +} + +// GetDomainManager mocks base method. +func (m *MockResource) GetDomainManager() persistence.DomainManager { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDomainManager") + ret0, _ := ret[0].(persistence.DomainManager) + return ret0 +} + +// GetDomainManager indicates an expected call of GetDomainManager. +func (mr *MockResourceMockRecorder) GetDomainManager() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomainManager", reflect.TypeOf((*MockResource)(nil).GetDomainManager)) +} + +// GetDomainMetricsScopeCache mocks base method. +func (m *MockResource) GetDomainMetricsScopeCache() cache.DomainMetricsScopeCache { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDomainMetricsScopeCache") + ret0, _ := ret[0].(cache.DomainMetricsScopeCache) + return ret0 +} + +// GetDomainMetricsScopeCache indicates an expected call of GetDomainMetricsScopeCache. +func (mr *MockResourceMockRecorder) GetDomainMetricsScopeCache() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomainMetricsScopeCache", reflect.TypeOf((*MockResource)(nil).GetDomainMetricsScopeCache)) +} + +// GetDomainReplicationQueue mocks base method. +func (m *MockResource) GetDomainReplicationQueue() domain.ReplicationQueue { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDomainReplicationQueue") + ret0, _ := ret[0].(domain.ReplicationQueue) + return ret0 +} + +// GetDomainReplicationQueue indicates an expected call of GetDomainReplicationQueue. +func (mr *MockResourceMockRecorder) GetDomainReplicationQueue() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomainReplicationQueue", reflect.TypeOf((*MockResource)(nil).GetDomainReplicationQueue)) +} + +// GetEventCache mocks base method. +func (m *MockResource) GetEventCache() events.Cache { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetEventCache") + ret0, _ := ret[0].(events.Cache) + return ret0 +} + +// GetEventCache indicates an expected call of GetEventCache. +func (mr *MockResourceMockRecorder) GetEventCache() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEventCache", reflect.TypeOf((*MockResource)(nil).GetEventCache)) +} + +// GetExecutionManager mocks base method. +func (m *MockResource) GetExecutionManager(arg0 int) (persistence.ExecutionManager, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetExecutionManager", arg0) + ret0, _ := ret[0].(persistence.ExecutionManager) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetExecutionManager indicates an expected call of GetExecutionManager. +func (mr *MockResourceMockRecorder) GetExecutionManager(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutionManager", reflect.TypeOf((*MockResource)(nil).GetExecutionManager), arg0) +} + +// GetFrontendClient mocks base method. +func (m *MockResource) GetFrontendClient() frontend.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetFrontendClient") + ret0, _ := ret[0].(frontend.Client) + return ret0 +} + +// GetFrontendClient indicates an expected call of GetFrontendClient. +func (mr *MockResourceMockRecorder) GetFrontendClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFrontendClient", reflect.TypeOf((*MockResource)(nil).GetFrontendClient)) +} + +// GetFrontendRawClient mocks base method. +func (m *MockResource) GetFrontendRawClient() frontend.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetFrontendRawClient") + ret0, _ := ret[0].(frontend.Client) + return ret0 +} + +// GetFrontendRawClient indicates an expected call of GetFrontendRawClient. +func (mr *MockResourceMockRecorder) GetFrontendRawClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFrontendRawClient", reflect.TypeOf((*MockResource)(nil).GetFrontendRawClient)) +} + +// GetHistoryClient mocks base method. +func (m *MockResource) GetHistoryClient() history.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHistoryClient") + ret0, _ := ret[0].(history.Client) + return ret0 +} + +// GetHistoryClient indicates an expected call of GetHistoryClient. +func (mr *MockResourceMockRecorder) GetHistoryClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoryClient", reflect.TypeOf((*MockResource)(nil).GetHistoryClient)) +} + +// GetHistoryManager mocks base method. +func (m *MockResource) GetHistoryManager() persistence.HistoryManager { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHistoryManager") + ret0, _ := ret[0].(persistence.HistoryManager) + return ret0 +} + +// GetHistoryManager indicates an expected call of GetHistoryManager. +func (mr *MockResourceMockRecorder) GetHistoryManager() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoryManager", reflect.TypeOf((*MockResource)(nil).GetHistoryManager)) +} + +// GetHistoryRawClient mocks base method. +func (m *MockResource) GetHistoryRawClient() history.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHistoryRawClient") + ret0, _ := ret[0].(history.Client) + return ret0 +} + +// GetHistoryRawClient indicates an expected call of GetHistoryRawClient. +func (mr *MockResourceMockRecorder) GetHistoryRawClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistoryRawClient", reflect.TypeOf((*MockResource)(nil).GetHistoryRawClient)) +} + +// GetHostInfo mocks base method. +func (m *MockResource) GetHostInfo() membership.HostInfo { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHostInfo") + ret0, _ := ret[0].(membership.HostInfo) + return ret0 +} + +// GetHostInfo indicates an expected call of GetHostInfo. +func (mr *MockResourceMockRecorder) GetHostInfo() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHostInfo", reflect.TypeOf((*MockResource)(nil).GetHostInfo)) +} + +// GetHostName mocks base method. +func (m *MockResource) GetHostName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHostName") + ret0, _ := ret[0].(string) + return ret0 +} + +// GetHostName indicates an expected call of GetHostName. +func (mr *MockResourceMockRecorder) GetHostName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHostName", reflect.TypeOf((*MockResource)(nil).GetHostName)) +} + +// GetIsolationGroupState mocks base method. +func (m *MockResource) GetIsolationGroupState() isolationgroup.State { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetIsolationGroupState") + ret0, _ := ret[0].(isolationgroup.State) + return ret0 +} + +// GetIsolationGroupState indicates an expected call of GetIsolationGroupState. +func (mr *MockResourceMockRecorder) GetIsolationGroupState() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetIsolationGroupState", reflect.TypeOf((*MockResource)(nil).GetIsolationGroupState)) +} + +// GetIsolationGroupStore mocks base method. +func (m *MockResource) GetIsolationGroupStore() configstore.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetIsolationGroupStore") + ret0, _ := ret[0].(configstore.Client) + return ret0 +} + +// GetIsolationGroupStore indicates an expected call of GetIsolationGroupStore. +func (mr *MockResourceMockRecorder) GetIsolationGroupStore() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetIsolationGroupStore", reflect.TypeOf((*MockResource)(nil).GetIsolationGroupStore)) +} + +// GetLogger mocks base method. +func (m *MockResource) GetLogger() log.Logger { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLogger") + ret0, _ := ret[0].(log.Logger) + return ret0 +} + +// GetLogger indicates an expected call of GetLogger. +func (mr *MockResourceMockRecorder) GetLogger() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogger", reflect.TypeOf((*MockResource)(nil).GetLogger)) +} + +// GetMatchingClient mocks base method. +func (m *MockResource) GetMatchingClient() matching.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMatchingClient") + ret0, _ := ret[0].(matching.Client) + return ret0 +} + +// GetMatchingClient indicates an expected call of GetMatchingClient. +func (mr *MockResourceMockRecorder) GetMatchingClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMatchingClient", reflect.TypeOf((*MockResource)(nil).GetMatchingClient)) +} + +// GetMatchingRawClient mocks base method. +func (m *MockResource) GetMatchingRawClient() matching.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMatchingRawClient") + ret0, _ := ret[0].(matching.Client) + return ret0 +} + +// GetMatchingRawClient indicates an expected call of GetMatchingRawClient. +func (mr *MockResourceMockRecorder) GetMatchingRawClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMatchingRawClient", reflect.TypeOf((*MockResource)(nil).GetMatchingRawClient)) +} + +// GetMembershipResolver mocks base method. +func (m *MockResource) GetMembershipResolver() membership.Resolver { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMembershipResolver") + ret0, _ := ret[0].(membership.Resolver) + return ret0 +} + +// GetMembershipResolver indicates an expected call of GetMembershipResolver. +func (mr *MockResourceMockRecorder) GetMembershipResolver() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMembershipResolver", reflect.TypeOf((*MockResource)(nil).GetMembershipResolver)) +} + +// GetMessagingClient mocks base method. +func (m *MockResource) GetMessagingClient() messaging.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMessagingClient") + ret0, _ := ret[0].(messaging.Client) + return ret0 +} + +// GetMessagingClient indicates an expected call of GetMessagingClient. +func (mr *MockResourceMockRecorder) GetMessagingClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMessagingClient", reflect.TypeOf((*MockResource)(nil).GetMessagingClient)) +} + +// GetMetricsClient mocks base method. +func (m *MockResource) GetMetricsClient() metrics.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMetricsClient") + ret0, _ := ret[0].(metrics.Client) + return ret0 +} + +// GetMetricsClient indicates an expected call of GetMetricsClient. +func (mr *MockResourceMockRecorder) GetMetricsClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetricsClient", reflect.TypeOf((*MockResource)(nil).GetMetricsClient)) +} + +// GetPartitioner mocks base method. +func (m *MockResource) GetPartitioner() partition.Partitioner { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPartitioner") + ret0, _ := ret[0].(partition.Partitioner) + return ret0 +} + +// GetPartitioner indicates an expected call of GetPartitioner. +func (mr *MockResourceMockRecorder) GetPartitioner() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPartitioner", reflect.TypeOf((*MockResource)(nil).GetPartitioner)) +} + +// GetPayloadSerializer mocks base method. +func (m *MockResource) GetPayloadSerializer() persistence.PayloadSerializer { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPayloadSerializer") + ret0, _ := ret[0].(persistence.PayloadSerializer) + return ret0 +} + +// GetPayloadSerializer indicates an expected call of GetPayloadSerializer. +func (mr *MockResourceMockRecorder) GetPayloadSerializer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPayloadSerializer", reflect.TypeOf((*MockResource)(nil).GetPayloadSerializer)) +} + +// GetPersistenceBean mocks base method. +func (m *MockResource) GetPersistenceBean() client0.Bean { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPersistenceBean") + ret0, _ := ret[0].(client0.Bean) + return ret0 +} + +// GetPersistenceBean indicates an expected call of GetPersistenceBean. +func (mr *MockResourceMockRecorder) GetPersistenceBean() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPersistenceBean", reflect.TypeOf((*MockResource)(nil).GetPersistenceBean)) +} + +// GetRemoteAdminClient mocks base method. +func (m *MockResource) GetRemoteAdminClient(cluster string) admin.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRemoteAdminClient", cluster) + ret0, _ := ret[0].(admin.Client) + return ret0 +} + +// GetRemoteAdminClient indicates an expected call of GetRemoteAdminClient. +func (mr *MockResourceMockRecorder) GetRemoteAdminClient(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRemoteAdminClient", reflect.TypeOf((*MockResource)(nil).GetRemoteAdminClient), cluster) +} + +// GetRemoteFrontendClient mocks base method. +func (m *MockResource) GetRemoteFrontendClient(cluster string) frontend.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRemoteFrontendClient", cluster) + ret0, _ := ret[0].(frontend.Client) + return ret0 +} + +// GetRemoteFrontendClient indicates an expected call of GetRemoteFrontendClient. +func (mr *MockResourceMockRecorder) GetRemoteFrontendClient(cluster interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRemoteFrontendClient", reflect.TypeOf((*MockResource)(nil).GetRemoteFrontendClient), cluster) +} + +// GetSDKClient mocks base method. +func (m *MockResource) GetSDKClient() workflowserviceclient.Interface { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSDKClient") + ret0, _ := ret[0].(workflowserviceclient.Interface) + return ret0 +} + +// GetSDKClient indicates an expected call of GetSDKClient. +func (mr *MockResourceMockRecorder) GetSDKClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSDKClient", reflect.TypeOf((*MockResource)(nil).GetSDKClient)) +} + +// GetServiceName mocks base method. +func (m *MockResource) GetServiceName() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetServiceName") + ret0, _ := ret[0].(string) + return ret0 +} + +// GetServiceName indicates an expected call of GetServiceName. +func (mr *MockResourceMockRecorder) GetServiceName() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetServiceName", reflect.TypeOf((*MockResource)(nil).GetServiceName)) +} + +// GetShardManager mocks base method. +func (m *MockResource) GetShardManager() persistence.ShardManager { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetShardManager") + ret0, _ := ret[0].(persistence.ShardManager) + return ret0 +} + +// GetShardManager indicates an expected call of GetShardManager. +func (mr *MockResourceMockRecorder) GetShardManager() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetShardManager", reflect.TypeOf((*MockResource)(nil).GetShardManager)) +} + +// GetTaskManager mocks base method. +func (m *MockResource) GetTaskManager() persistence.TaskManager { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTaskManager") + ret0, _ := ret[0].(persistence.TaskManager) + return ret0 +} + +// GetTaskManager indicates an expected call of GetTaskManager. +func (mr *MockResourceMockRecorder) GetTaskManager() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskManager", reflect.TypeOf((*MockResource)(nil).GetTaskManager)) +} + +// GetThrottledLogger mocks base method. +func (m *MockResource) GetThrottledLogger() log.Logger { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetThrottledLogger") + ret0, _ := ret[0].(log.Logger) + return ret0 +} + +// GetThrottledLogger indicates an expected call of GetThrottledLogger. +func (mr *MockResourceMockRecorder) GetThrottledLogger() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetThrottledLogger", reflect.TypeOf((*MockResource)(nil).GetThrottledLogger)) +} + +// GetTimeSource mocks base method. +func (m *MockResource) GetTimeSource() clock.TimeSource { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTimeSource") + ret0, _ := ret[0].(clock.TimeSource) + return ret0 +} + +// GetTimeSource indicates an expected call of GetTimeSource. +func (mr *MockResourceMockRecorder) GetTimeSource() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTimeSource", reflect.TypeOf((*MockResource)(nil).GetTimeSource)) +} + +// GetVisibilityManager mocks base method. +func (m *MockResource) GetVisibilityManager() persistence.VisibilityManager { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVisibilityManager") + ret0, _ := ret[0].(persistence.VisibilityManager) + return ret0 +} + +// GetVisibilityManager indicates an expected call of GetVisibilityManager. +func (mr *MockResourceMockRecorder) GetVisibilityManager() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVisibilityManager", reflect.TypeOf((*MockResource)(nil).GetVisibilityManager)) +} + +// Start mocks base method. +func (m *MockResource) Start() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Start") +} + +// Start indicates an expected call of Start. +func (mr *MockResourceMockRecorder) Start() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockResource)(nil).Start)) +} + +// Stop mocks base method. +func (m *MockResource) Stop() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Stop") +} + +// Stop indicates an expected call of Stop. +func (mr *MockResourceMockRecorder) Stop() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*MockResource)(nil).Stop)) +} From 77b58781e4edcd68e362741026c69b8757b02946 Mon Sep 17 00:00:00 2001 From: Ketsia Date: Tue, 23 Apr 2024 21:27:01 +0200 Subject: [PATCH 2/2] use gomock.Any only when expected args is outside of unit scope --- service/history/decision/handler_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/service/history/decision/handler_test.go b/service/history/decision/handler_test.go index a2cda374c53..1ac68110a83 100644 --- a/service/history/decision/handler_test.go +++ b/service/history/decision/handler_test.go @@ -614,22 +614,32 @@ func TestHandleDecisionTaskCompleted(t *testing.T) { ScheduleID: 0, } decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Deserialize(_serializedTestToken).Return(_deserializedTestToken, nil) - decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Serialize(gomock.Any()).Return(_serializedTestToken, nil) + decisionHandler.tokenSerializer.(*common.MockTaskTokenSerializer).EXPECT().Serialize(&common.TaskToken{ + DomainID: constants.TestDomainID, + WorkflowID: constants.TestWorkflowID, + WorkflowType: _testWorkflowTypeName, + RunID: constants.TestRunID, + ScheduleID: 1, + ActivityID: "some-activity-id", + ActivityType: "some-activity-name", + }).Return(_serializedTestToken, nil) eventsCache := events.NewMockCache(ctrl) decisionHandler.shard.(*shard.MockContext).EXPECT().GetEventsCache().Times(1).Return(eventsCache) - eventsCache.EXPECT().PutEvent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) + eventsCache.EXPECT().PutEvent(constants.TestDomainID, constants.TestWorkflowID, constants.TestRunID, int64(1), gomock.Any()) decisionHandler.shard.(*shard.MockContext).EXPECT().GetShardID().Times(1).Return(_testShardID) - decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(gomock.Any()).Times(2).Return([]int64{0, 1, 2, 3, 4, 5}, nil) + decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(4).Return([]int64{0, 1, 2, 3}, nil) + decisionHandler.shard.(*shard.MockContext).EXPECT().GenerateTransferTaskIDs(6).Return([]int64{0, 1, 2, 3, 4, 5}, nil) decisionHandler.shard.(*shard.MockContext).EXPECT().AppendHistoryV2Events(gomock.Any(), gomock.Any(), constants.TestDomainID, types.WorkflowExecution{ WorkflowID: constants.TestWorkflowID, RunID: constants.TestRunID, }).Return(&persistence.AppendHistoryNodesResponse{}, nil) - decisionHandler.shard.(*shard.MockContext).EXPECT().UpdateWorkflowExecution(gomock.Any(), gomock.Any()).Return(&persistence.UpdateWorkflowExecutionResponse{}, nil) + decisionHandler.shard.(*shard.MockContext).EXPECT().UpdateWorkflowExecution(context.Background(), gomock.Any()).Return(&persistence.UpdateWorkflowExecutionResponse{}, nil) engine := engine.NewMockEngine(ctrl) decisionHandler.shard.(*shard.MockContext).EXPECT().GetEngine().Return(engine).Times(3) - engine.EXPECT().NotifyNewHistoryEvent(gomock.Any()) + engine.EXPECT().NotifyNewHistoryEvent(events.NewNotification(constants.TestDomainID, &types.WorkflowExecution{WorkflowID: constants.TestWorkflowID, RunID: constants.TestRunID}, + 0, 5, 0, nil, 1, 0)) engine.EXPECT().NotifyNewTransferTasks(gomock.Any()) engine.EXPECT().NotifyNewTimerTasks(gomock.Any()) engine.EXPECT().NotifyNewCrossClusterTasks(gomock.Any())