Skip to content

Commit

Permalink
Fix cron workflow didn't carry over properties (cadence-workflow#2509)
Browse files Browse the repository at this point in the history
  • Loading branch information
vancexu authored Sep 4, 2019
1 parent 1a7583a commit 67bc4fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ func (s *integrationSuite) TestCronWorkflow() {
taskList := &workflow.TaskList{}
taskList.Name = common.StringPtr(tl)

memo := &workflow.Memo{
Fields: map[string][]byte{"memoKey": []byte("memoVal")},
}

request := &workflow.StartWorkflowExecutionRequest{
RequestId: common.StringPtr(uuid.New()),
Domain: common.StringPtr(s.domainName),
Expand All @@ -867,6 +871,7 @@ func (s *integrationSuite) TestCronWorkflow() {
TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1),
Identity: common.StringPtr(identity),
CronSchedule: common.StringPtr(cronSchedule), //minimum interval by standard spec is 1m (* * * * *), use non-standard descriptor for short interval for test
Memo: memo,
}

startWorkflowTS := time.Now()
Expand Down Expand Up @@ -963,6 +968,7 @@ func (s *integrationSuite) TestCronWorkflow() {
s.Equal(workflow.ContinueAsNewInitiatorCronSchedule, attributes.GetInitiator())
s.Equal("cron-test-error", attributes.GetFailureReason())
s.Equal(0, len(attributes.GetLastCompletionResult()))
s.Equal(memo, attributes.Memo)

events = s.getHistory(s.domainName, executions[1])
lastEvent = events[len(events)-1]
Expand All @@ -971,6 +977,7 @@ func (s *integrationSuite) TestCronWorkflow() {
s.Equal(workflow.ContinueAsNewInitiatorCronSchedule, attributes.GetInitiator())
s.Equal("", attributes.GetFailureReason())
s.Equal("cron-test-result", string(attributes.GetLastCompletionResult()))
s.Equal(memo, attributes.Memo)

events = s.getHistory(s.domainName, executions[2])
lastEvent = events[len(events)-1]
Expand All @@ -979,6 +986,7 @@ func (s *integrationSuite) TestCronWorkflow() {
s.Equal(workflow.ContinueAsNewInitiatorCronSchedule, attributes.GetInitiator())
s.Equal("cron-test-error", attributes.GetFailureReason())
s.Equal("cron-test-result", string(attributes.GetLastCompletionResult()))
s.Equal(memo, attributes.Memo)

startFilter.LatestTime = common.Int64Ptr(time.Now().UnixNano())
var closedExecutions []*workflow.WorkflowExecutionInfo
Expand Down
3 changes: 3 additions & 0 deletions service/history/decisionTaskHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ func (handler *decisionTaskHandlerImpl) retryCronContinueAsNew(
FailureReason: failureReason,
FailureDetails: failureDetails,
LastCompletionResult: lastCompletionResult,
Header: attr.Header,
Memo: attr.Memo,
SearchAttributes: attr.SearchAttributes,
}

_, newStateBuilder, err := handler.mutableState.AddContinueAsNewEvent(
Expand Down

0 comments on commit 67bc4fa

Please sign in to comment.