1773
}
1774
1776
>
branchToken, baseSnapshot, baseEvents := s.CreateWorkflow(
1777
>
rand.Int63(),
1778
>
enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
1779
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
1780
>
rand.Int63(),
1781
>
)
1782
>
1783
>
resetSnapshot, resetEvents := RandomSnapshot(
1784
>
s.T(),
1785
>
s.NamespaceID,
1786
>
s.WorkflowID,
1787
>
s.RunID,
1788
>
baseSnapshot.NextEventID,
1789
>
rand.Int63(),
1790
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
1791
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
1792
>
baseSnapshot.DBRecordVersion+1,
1793
>
branchToken,
1794
>
)
1795
>
newRunID := uuid.New().String()
1796
>
newBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, newRunID, s.HistoryBranchUtil)
1797
>
newSnapshot, newEvents := RandomSnapshot(
1798
>
s.T(),
1799
>
s.NamespaceID,
1800
>
s.WorkflowID,
1801
>
newRunID,
1802
>
common.FirstEventID,
1803
>
rand.Int63(),
1804
>
enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
1805
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
1806
>
rand.Int63(),
1807
>
newBranchToken,
1808
>
)
1809
>
_, err := s.ExecutionManager.ConflictResolveWorkflowExecution(s.Ctx, &p.ConflictResolveWorkflowExecutionRequest{
1810
>
ShardID: s.ShardID,
1811
>
RangeID: s.RangeID,
1812
>
Mode: p.ConflictResolveWorkflowModeUpdateCurrent,
1813
>
1814
>
ArchetypeID: chasm.WorkflowArchetypeID,
1815
>
1816
>
ResetWorkflowSnapshot: *resetSnapshot,
1817
>
ResetWorkflowEvents: resetEvents,
1818
>
1819
>
NewWorkflowSnapshot: newSnapshot,
1820
>
NewWorkflowEvents: newEvents,
1821
>
1822
>
CurrentWorkflowMutation: nil,
1823
>
CurrentWorkflowEvents: nil,
1824
>
})
1825
>
s.NoError(err)
1826
>
1827
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, resetSnapshot)
1828
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot)
1829
>
s.AssertHEEqualWithDB(branchToken, baseEvents, resetEvents)
1830
>
s.AssertHEEqualWithDB(newBranchToken, newEvents)
1831
>
}
1832
1833
func (s *ExecutionMutableStateSuite) TestConflictResolve_Zombie() {