960
}
961
963
>
branchToken, newSnapshot, newEvents := s.CreateWorkflow(
964
>
rand.Int63(),
965
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
966
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
967
>
rand.Int63(),
968
>
)
969
>
970
>
// NOTE: no new events for closed workflows
971
>
currentMutation, _ := RandomMutation(
972
>
s.T(),
973
>
s.NamespaceID,
974
>
s.WorkflowID,
975
>
s.RunID,
976
>
newSnapshot.NextEventID,
977
>
rand.Int63(),
978
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
979
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
980
>
newSnapshot.DBRecordVersion+1,
981
>
branchToken,
982
>
)
983
>
_, err := s.ExecutionManager.UpdateWorkflowExecution(s.Ctx, &p.UpdateWorkflowExecutionRequest{
984
>
ShardID: s.ShardID,
985
>
RangeID: s.RangeID,
986
>
Mode: p.UpdateWorkflowModeIgnoreCurrent,
987
>
988
>
ArchetypeID: chasm.WorkflowArchetypeID,
989
>
990
>
UpdateWorkflowMutation: *currentMutation,
991
>
UpdateWorkflowEvents: nil,
992
>
993
>
NewWorkflowSnapshot: nil,
994
>
NewWorkflowEvents: nil,
995
>
})
996
>
s.NoError(err)
997
>
998
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot, currentMutation)
999
>
s.AssertHEEqualWithDB(branchToken, newEvents)
1000
>
}
1001
1002
func (s *ExecutionMutableStateSuite) TestUpdate_ClosedWorkflow_IsNonCurrent() {