@@ -1455,10 +1455,16 @@ func (s *rawTaskConverterSuite) TestConvertSyncVersionedTransitionTask_Mutation(
14551455 ).Return (s .workflowContext , s .releaseFn , nil )
14561456 s .workflowContext .EXPECT ().LoadMutableState (gomock .Any (), s .shardContext ).Return (s .mutableState , nil ).Times (1 )
14571457 s .mutableState .EXPECT ().GetExecutionInfo ().Return (& persistencespb.WorkflowExecutionInfo {
1458- VersionHistories : versionHistories ,
1459- TransitionHistory : transitionHistory ,
1460- }).Times (3 )
1458+ VersionHistories : versionHistories ,
1459+ TransitionHistory : transitionHistory ,
1460+ CloseTransferTaskId : 0 ,
1461+ }).Times (2 )
14611462 s .mutableState .EXPECT ().HasBufferedEvents ().Return (false ).Times (1 )
1463+ s .mutableState .EXPECT ().GetWorkflowKey ().Return (definition.WorkflowKey {
1464+ NamespaceID : s .namespaceID ,
1465+ WorkflowID : s .workflowID ,
1466+ RunID : s .runID ,
1467+ }).Times (1 )
14621468
14631469 s .progressCache .EXPECT ().Get (
14641470 s .runID ,
@@ -1582,10 +1588,16 @@ func (s *rawTaskConverterSuite) TestConvertSyncVersionedTransitionTask_FirstTask
15821588 ).Return (s .workflowContext , s .releaseFn , nil )
15831589 s .workflowContext .EXPECT ().LoadMutableState (gomock .Any (), s .shardContext ).Return (s .mutableState , nil ).Times (1 )
15841590 s .mutableState .EXPECT ().GetExecutionInfo ().Return (& persistencespb.WorkflowExecutionInfo {
1585- VersionHistories : versionHistories ,
1586- TransitionHistory : transitionHistory ,
1587- }).Times (3 )
1591+ VersionHistories : versionHistories ,
1592+ TransitionHistory : transitionHistory ,
1593+ CloseTransferTaskId : 0 ,
1594+ }).Times (2 )
15881595 s .mutableState .EXPECT ().HasBufferedEvents ().Return (false ).Times (1 )
1596+ s .mutableState .EXPECT ().GetWorkflowKey ().Return (definition.WorkflowKey {
1597+ NamespaceID : s .namespaceID ,
1598+ WorkflowID : s .workflowID ,
1599+ RunID : s .runID ,
1600+ }).Times (1 )
15891601
15901602 s .progressCache .EXPECT ().Get (
15911603 s .runID ,
@@ -1704,28 +1716,37 @@ func (s *rawTaskConverterSuite) TestConvertSyncVersionedTransitionTask_HasBuffer
17041716}
17051717
17061718func (s * rawTaskConverterSuite ) TestIsCloseTransferTaskAcked_ZeroTaskId () {
1707- mu := historyi .NewMockMutableState (s .controller )
1708- executionInfo := & persistencespb.WorkflowExecutionInfo {
1709- CloseTransferTaskId : 0 ,
1719+ testCloseTaskID := int64 (0 )
1720+ workflowKey := definition.WorkflowKey {
1721+ NamespaceID : s .namespaceID ,
1722+ WorkflowID : s .workflowID ,
1723+ RunID : s .runID ,
1724+ }
1725+ closeTransferTask := & tasks.CloseExecutionTask {
1726+ WorkflowKey : workflowKey ,
1727+ TaskID : testCloseTaskID ,
17101728 }
1711- mu .EXPECT ().GetExecutionInfo ().Return (executionInfo )
17121729
17131730 converter := newSyncVersionedTransitionTaskConverter (s .shardContext , s .workflowCache , nil , s .progressCache , s .executionManager , s .syncStateRetriever , s .logger )
1714- result := converter .isCloseTransferTaskAcked (mu )
1731+ result := converter .isCloseTransferTaskAcked (closeTransferTask )
17151732 s .False (result )
17161733}
17171734
17181735func (s * rawTaskConverterSuite ) TestIsCloseTransferTaskAcked_QueueStateNotAvailable () {
1719- mu := historyi .NewMockMutableState (s .controller )
17201736 testCloseTaskID := int64 (12345 )
1721- executionInfo := & persistencespb.WorkflowExecutionInfo {
1722- CloseTransferTaskId : testCloseTaskID ,
1737+ workflowKey := definition.WorkflowKey {
1738+ NamespaceID : s .namespaceID ,
1739+ WorkflowID : s .workflowID ,
1740+ RunID : s .runID ,
1741+ }
1742+ closeTransferTask := & tasks.CloseExecutionTask {
1743+ WorkflowKey : workflowKey ,
1744+ TaskID : testCloseTaskID ,
17231745 }
1724- mu .EXPECT ().GetExecutionInfo ().Return (executionInfo )
17251746
17261747 // Queue state not set, so should return false
17271748 converter := newSyncVersionedTransitionTaskConverter (s .shardContext , s .workflowCache , nil , s .progressCache , s .executionManager , s .syncStateRetriever , s .logger )
1728- result := converter .isCloseTransferTaskAcked (mu )
1749+ result := converter .isCloseTransferTaskAcked (closeTransferTask )
17291750 s .False (result )
17301751}
17311752
@@ -1798,19 +1819,17 @@ func (s *rawTaskConverterSuite) TestIsCloseTransferTaskAcked_TaskAcked() {
17981819
17991820 converter := newSyncVersionedTransitionTaskConverter (mockShard , s .workflowCache , nil , s .progressCache , s .executionManager , s .syncStateRetriever , s .logger )
18001821
1801- mu := historyi .NewMockMutableState (s .controller )
18021822 workflowKey := definition.WorkflowKey {
18031823 NamespaceID : s .namespaceID ,
18041824 WorkflowID : s .workflowID ,
18051825 RunID : s .runID ,
18061826 }
1807- executionInfo := & persistencespb.WorkflowExecutionInfo {
1808- CloseTransferTaskId : testCloseTaskID ,
1827+ closeTransferTask := & tasks.CloseExecutionTask {
1828+ WorkflowKey : workflowKey ,
1829+ TaskID : testCloseTaskID ,
18091830 }
1810- mu .EXPECT ().GetExecutionInfo ().Return (executionInfo )
1811- mu .EXPECT ().GetWorkflowKey ().Return (workflowKey )
18121831
1813- result := converter .isCloseTransferTaskAcked (mu )
1832+ result := converter .isCloseTransferTaskAcked (closeTransferTask )
18141833 s .True (result )
18151834}
18161835
@@ -1842,19 +1861,17 @@ func (s *rawTaskConverterSuite) TestIsCloseTransferTaskAcked_TaskNotAcked() {
18421861
18431862 converter := newSyncVersionedTransitionTaskConverter (mockShard , s .workflowCache , nil , s .progressCache , s .executionManager , s .syncStateRetriever , s .logger )
18441863
1845- mu := historyi .NewMockMutableState (s .controller )
18461864 workflowKey := definition.WorkflowKey {
18471865 NamespaceID : s .namespaceID ,
18481866 WorkflowID : s .workflowID ,
18491867 RunID : s .runID ,
18501868 }
1851- executionInfo := & persistencespb.WorkflowExecutionInfo {
1852- CloseTransferTaskId : testCloseTaskID ,
1869+ closeTransferTask := & tasks.CloseExecutionTask {
1870+ WorkflowKey : workflowKey ,
1871+ TaskID : testCloseTaskID ,
18531872 }
1854- mu .EXPECT ().GetExecutionInfo ().Return (executionInfo )
1855- mu .EXPECT ().GetWorkflowKey ().Return (workflowKey )
18561873
1857- result := converter .isCloseTransferTaskAcked (mu )
1874+ result := converter .isCloseTransferTaskAcked (closeTransferTask )
18581875 s .False (result )
18591876}
18601877
@@ -1911,18 +1928,16 @@ func (s *rawTaskConverterSuite) TestIsCloseTransferTaskAcked_TaskNotAcked_Contai
19111928
19121929 converter := newSyncVersionedTransitionTaskConverter (mockShard , s .workflowCache , nil , s .progressCache , s .executionManager , s .syncStateRetriever , s .logger )
19131930
1914- mu := historyi .NewMockMutableState (s .controller )
19151931 workflowKey := definition.WorkflowKey {
19161932 NamespaceID : s .namespaceID ,
19171933 WorkflowID : s .workflowID ,
19181934 RunID : s .runID ,
19191935 }
1920- executionInfo := & persistencespb.WorkflowExecutionInfo {
1921- CloseTransferTaskId : testCloseTaskID ,
1936+ closeTransferTask := & tasks.CloseExecutionTask {
1937+ WorkflowKey : workflowKey ,
1938+ TaskID : testCloseTaskID ,
19221939 }
1923- mu .EXPECT ().GetExecutionInfo ().Return (executionInfo )
1924- mu .EXPECT ().GetWorkflowKey ().Return (workflowKey )
19251940
1926- result := converter .isCloseTransferTaskAcked (mu )
1941+ result := converter .isCloseTransferTaskAcked (closeTransferTask )
19271942 s .False (result )
19281943}
0 commit comments