Skip to content

Commit

Permalink
Fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Nov 13, 2024
1 parent 3b07474 commit 3a151d2
Show file tree
Hide file tree
Showing 7 changed files with 428 additions and 430 deletions.
12 changes: 5 additions & 7 deletions service/history/history_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1759,13 +1759,11 @@ func (s *engineSuite) testRespondWorkflowTaskCompletedSignalGeneration() *histor
_, err := s.historyEngine.SignalWorkflowExecution(context.Background(), signalRequest)
s.NoError(err)

if !skipGenerateTask {
s.mockSearchAttributesProvider.EXPECT().GetSearchAttributes(gomock.Any(), false).Return(searchattribute.TestNameTypeMap, nil)
s.mockSearchAttributesMapperProvider.EXPECT().GetMapper(tests.Namespace).Return(&searchattribute.TestMapper{Namespace: tests.Namespace.String()}, nil).AnyTimes()
s.mockNamespaceCache.EXPECT().GetNamespaceName(tests.NamespaceID).Return(tests.Namespace, nil)
s.mockVisibilityMgr.EXPECT().GetIndexName().Return(esIndexName).AnyTimes()
s.mockExecutionMgr.EXPECT().ReadHistoryBranch(gomock.Any(), gomock.Any()).Return(&persistence.ReadHistoryBranchResponse{HistoryEvents: []*historypb.HistoryEvent{}}, nil)
}
s.mockSearchAttributesProvider.EXPECT().GetSearchAttributes(gomock.Any(), false).Return(searchattribute.TestNameTypeMap, nil)
s.mockSearchAttributesMapperProvider.EXPECT().GetMapper(tests.Namespace).Return(&searchattribute.TestMapper{Namespace: tests.Namespace.String()}, nil).AnyTimes()
s.mockNamespaceCache.EXPECT().GetNamespaceName(tests.NamespaceID).Return(tests.Namespace, nil)
s.mockVisibilityMgr.EXPECT().GetIndexName().Return(esIndexName).AnyTimes()
s.mockExecutionMgr.EXPECT().ReadHistoryBranch(gomock.Any(), gomock.Any()).Return(&persistence.ReadHistoryBranchResponse{HistoryEvents: []*historypb.HistoryEvent{}}, nil)

var commands []*commandpb.Command
resp, err := s.historyEngine.RespondWorkflowTaskCompleted(context.Background(), &historyservice.RespondWorkflowTaskCompletedRequest{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,6 @@ func (s *sutTestingAdapter) AddWorkflowExecutionSignaledEvent(_ ...eventConfig)
nil,
"identity-1",
nil,
false,
nil,
nil,
)
Expand Down
3 changes: 1 addition & 2 deletions service/history/historybuilder/history_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (s *historyBuilderSuite) TestWorkflowExecutionCancelRequested() {
func (s *historyBuilderSuite) TestWorkflowExecutionSignaled() {
signalName := "random signal name"
event := s.historyBuilder.AddWorkflowExecutionSignaledEvent(
signalName, testPayloads, testIdentity, testHeader, false, nil, nil,
signalName, testPayloads, testIdentity, testHeader, nil, nil,
)
s.Equal(event, s.flush())
s.Equal(&historypb.HistoryEvent{
Expand Down Expand Up @@ -2370,7 +2370,6 @@ func (s *historyBuilderSuite) TestBufferSize_Memory() {
&commonpb.Payloads{},
"identity",
&commonpb.Header{},
false,
nil,
nil,
)
Expand Down
2 changes: 1 addition & 1 deletion service/history/ndc/workflow_resetter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ func (s *workflowResetterSuite) TestReapplyEvents_Excludes() {
ms := workflow.NewMockMutableState(s.controller)
// Assert that none of these following methods are invoked.
arg := gomock.Any()
ms.EXPECT().AddWorkflowExecutionSignaled(arg, arg, arg, arg, arg, arg).Times(0)
ms.EXPECT().AddWorkflowExecutionSignaled(arg, arg, arg, arg, arg).Times(0)
ms.EXPECT().AddWorkflowExecutionUpdateAdmittedEvent(arg, arg).Times(0)
ms.EXPECT().AddHistoryEvent(arg, arg).Times(0)

Expand Down
2 changes: 0 additions & 2 deletions service/history/workflow/mutable_state_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,6 @@ func (s *mutableStateSuite) TestTotalEntitiesCount() {
&commonpb.Payloads{},
"identity",
&commonpb.Header{},
false,
nil,
)
s.NoError(err)
Expand Down Expand Up @@ -1915,7 +1914,6 @@ func (s *mutableStateSuite) TestCloseTransactionUpdateTransition() {
&commonpb.Payloads{},
"identity",
&commonpb.Header{},
false,
nil,
nil,
)
Expand Down
837 changes: 421 additions & 416 deletions service/history/workflow/mutable_state_mock.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func addWorkflowExecutionSignaled(t *testing.T, i int, ms *workflow.MutableState
payload,
identity,
header,
false,
nil,
)
if err != nil {
Expand Down

0 comments on commit 3a151d2

Please sign in to comment.