439
}
440
442
>
prevLastWriteVersion := rand.Int63()
443
>
_, prevSnapshot, _ := s.CreateWorkflow(
444
>
prevLastWriteVersion,
445
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
446
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
447
>
rand.Int63(),
448
>
)
449
>
450
>
newRunID := uuid.New().String()
451
>
newBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, newRunID, s.HistoryBranchUtil)
452
>
newSnapshot, newEvents := RandomSnapshot(
453
>
s.T(),
454
>
s.NamespaceID,
455
>
s.WorkflowID,
456
>
newRunID,
457
>
common.FirstEventID,
458
>
rand.Int63(),
459
>
enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
460
>
enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
461
>
rand.Int63(),
462
>
newBranchToken,
463
>
)
464
>
465
>
_, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
466
>
ShardID: s.ShardID,
467
>
RangeID: s.RangeID,
468
>
Mode: p.CreateWorkflowModeUpdateCurrent,
469
>
470
>
PreviousRunID: prevSnapshot.ExecutionState.RunId,
471
>
PreviousLastWriteVersion: prevLastWriteVersion,
472
>
473
>
ArchetypeID: chasm.WorkflowArchetypeID,
474
>
475
>
NewWorkflowSnapshot: *newSnapshot,
476
>
NewWorkflowEvents: newEvents,
477
>
})
478
>
s.NoError(err)
479
>
480
>
s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot)
481
>
s.AssertHEEqualWithDB(newBranchToken, newEvents)
482
>
}
483
484
func (s *ExecutionMutableStateSuite) TestUpdate_NotZombie() {