396
}
397
399
>
prevLastWriteVersion := rand.Int63()
400
>
s.CreateWorkflow(
401
>
prevLastWriteVersion,
402
>
enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
403
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
404
>
rand.Int63(),
405
>
)
406
>
407
>
newRunID := uuid.New().String()
408
>
newBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, newRunID, s.HistoryBranchUtil)
409
>
newSnapshot, newEvents := RandomSnapshot(
410
>
s.T(),
411
>
s.NamespaceID,
412
>
s.WorkflowID,
413
>
newRunID,
414
>
common.FirstEventID,
415
>
rand.Int63(),
416
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
417
>
enumspb.WORKFLOW_EXECUTION_STATUS_TERMINATED,
418
>
rand.Int63(),
419
>
newBranchToken,
420
>
)
421
>
422
>
_, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
423
>
ShardID: s.ShardID,
424
>
RangeID: s.RangeID,
425
>
Mode: p.CreateWorkflowModeBypassCurrent,
426
>
427
>
PreviousRunID: "",
428
>
PreviousLastWriteVersion: 0,
429
>
430
>
ArchetypeID: chasm.WorkflowArchetypeID,
431
>
432
>
NewWorkflowSnapshot: *newSnapshot,
433
>
NewWorkflowEvents: newEvents,
434
>
})
435
>
s.NoError(err)
436
>
437
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot)
438
>
s.AssertHEEqualWithDB(newBranchToken, newEvents)
439
>
}
440
441
func (s *ExecutionMutableStateSuite) TestCreate_ClosedWorkflow_UpdateCurrent() {