316
}
317
319
>
prevLastWriteVersion := rand.Int63()
320
>
s.CreateWorkflow(
321
>
prevLastWriteVersion,
322
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
323
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
324
>
rand.Int63(),
325
>
)
326
>
327
>
newRunID := uuid.New().String()
328
>
newBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, newRunID, s.HistoryBranchUtil)
329
>
newSnapshot, newEvents := RandomSnapshot(
330
>
s.T(),
331
>
s.NamespaceID,
332
>
s.WorkflowID,
333
>
newRunID,
334
>
common.FirstEventID,
335
>
rand.Int63(),
336
>
enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE,
337
>
enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
338
>
rand.Int63(),
339
>
newBranchToken,
340
>
)
341
>
342
>
_, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
343
>
ShardID: s.ShardID,
344
>
RangeID: s.RangeID,
345
>
Mode: p.CreateWorkflowModeBypassCurrent,
346
>
347
>
PreviousRunID: "",
348
>
PreviousLastWriteVersion: 0,
349
>
350
>
ArchetypeID: chasm.WorkflowArchetypeID,
351
>
352
>
NewWorkflowSnapshot: *newSnapshot,
353
>
NewWorkflowEvents: newEvents,
354
>
})
355
>
s.NoError(err)
356
>
357
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot)
358
>
s.AssertHEEqualWithDB(newBranchToken, newEvents)
359
>
}
360
361
func (s *ExecutionMutableStateSuite) TestCreate_Conflict() {