@@ -1473,6 +1473,7 @@ func (s *engine2Suite) TestStartWorkflowExecution_BrandNew_DuplicateRequestError
14731473 s .mockShard .Resource .ActiveClusterMgr .EXPECT ().GetActiveClusterInfoByClusterAttribute (gomock .Any (), constants .TestDomainID , gomock .Any ()).Return (testActiveClusterInfo , nil ).Times (1 )
14741474
14751475 s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Once ()
1476+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Once ()
14761477 s .mockExecutionMgr .On ("CreateWorkflowExecution" , mock .Anything , mock .MatchedBy (func (request * p.CreateWorkflowExecutionRequest ) bool {
14771478 return ! request .NewWorkflowSnapshot .ExecutionInfo .StartTimestamp .IsZero () && reflect .DeepEqual (partitionConfig , request .NewWorkflowSnapshot .ExecutionInfo .PartitionConfig )
14781479 })).Return (nil , & p.DuplicateRequestError {RequestType : p .WorkflowRequestTypeSignal , RunID : "test-run-id" }).Once ()
@@ -1555,6 +1556,7 @@ func (s *engine2Suite) TestStartWorkflowExecution_StillRunning_NonDeDup() {
15551556 s .mockShard .Resource .ActiveClusterMgr .EXPECT ().GetActiveClusterInfoByClusterAttribute (gomock .Any (), constants .TestDomainID , gomock .Any ()).Return (testActiveClusterInfo , nil ).Times (1 )
15561557
15571558 s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Once ()
1559+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Once ()
15581560 s .mockExecutionMgr .On ("CreateWorkflowExecution" , mock .Anything , mock .Anything ).Return (nil , & p.WorkflowExecutionAlreadyStartedError {
15591561 Msg : "random message" ,
15601562 StartRequestID : "oldRequestID" ,
@@ -1687,6 +1689,7 @@ func (s *engine2Suite) TestStartWorkflowExecution_NotRunning_PrevSuccess_Duplica
16871689 LastWriteVersion : lastWriteVersion ,
16881690 }).Once ()
16891691
1692+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Once ()
16901693 s .mockExecutionMgr .On (
16911694 "CreateWorkflowExecution" ,
16921695 mock .Anything ,
@@ -1744,7 +1747,8 @@ func (s *engine2Suite) TestStartWorkflowExecution_NotRunning_PrevSuccess() {
17441747
17451748 expectedErrs := []bool {true , false , true }
17461749
1747- s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Times (len (expectedErrs ))
1750+ s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Times (3 )
1751+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Times (2 )
17481752 s .mockExecutionMgr .On (
17491753 "CreateWorkflowExecution" ,
17501754 mock .Anything ,
@@ -1840,7 +1844,8 @@ func (s *engine2Suite) TestStartWorkflowExecution_NotRunning_PrevFail() {
18401844
18411845 for i , closeState := range closeStates {
18421846
1843- s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Times (len (expectedErrs ))
1847+ s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Times (3 )
1848+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Times (1 )
18441849 s .mockExecutionMgr .On (
18451850 "CreateWorkflowExecution" ,
18461851 mock .Anything ,
@@ -2175,6 +2180,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_WorkflowNotExist_Dup
21752180
21762181 s .mockExecutionMgr .On ("GetCurrentExecution" , mock .Anything , mock .Anything ).Return (nil , notExistErr ).Once ()
21772182 s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Once ()
2183+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Once ()
21782184 s .mockExecutionMgr .On ("CreateWorkflowExecution" , mock .Anything , mock .MatchedBy (func (request * p.CreateWorkflowExecutionRequest ) bool {
21792185 return ! request .NewWorkflowSnapshot .ExecutionInfo .StartTimestamp .IsZero () && reflect .DeepEqual (partitionConfig , request .NewWorkflowSnapshot .ExecutionInfo .PartitionConfig )
21802186 })).Return (nil , & p.DuplicateRequestError {RequestType : p .WorkflowRequestTypeCancel , RunID : "test-run-id" }).Once ()
@@ -2469,6 +2475,7 @@ func (s *engine2Suite) TestSignalWithStartWorkflowExecution_Start_WorkflowAlread
24692475 s .mockExecutionMgr .On ("GetCurrentExecution" , mock .Anything , mock .Anything ).Return (gceResponse , nil ).Once ()
24702476 s .mockExecutionMgr .On ("GetWorkflowExecution" , mock .Anything , mock .Anything ).Return (gwmsResponse , nil ).Once ()
24712477 s .mockHistoryV2Mgr .On ("AppendHistoryNodes" , mock .Anything , mock .Anything ).Return (& p.AppendHistoryNodesResponse {}, nil ).Once ()
2478+ s .mockHistoryV2Mgr .On ("DeleteHistoryBranch" , mock .Anything , mock .Anything ).Return (nil ).Once ()
24722479 s .mockExecutionMgr .On ("CreateWorkflowExecution" , mock .Anything , mock .Anything ).Return (nil , workflowAlreadyStartedErr ).Once ()
24732480
24742481 resp , err := s .historyEngine .SignalWithStartWorkflowExecution (context .Background (), sRequest )
0 commit comments