Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of decision attributes #555

Merged
merged 3 commits into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gen/go/shared/idl.go

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .gen/go/shared/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3748,7 +3748,6 @@ func (s *integrationSuite) TestChildWorkflowExecution() {
return nil, []*workflow.Decision{{
DecisionType: common.DecisionTypePtr(workflow.DecisionTypeStartChildWorkflowExecution),
StartChildWorkflowExecutionDecisionAttributes: &workflow.StartChildWorkflowExecutionDecisionAttributes{
Domain: common.StringPtr(s.domainName),
WorkflowId: common.StringPtr(childID),
WorkflowType: childWorkflowType,
TaskList: taskListChild,
Expand Down Expand Up @@ -3841,7 +3840,7 @@ func (s *integrationSuite) TestChildWorkflowExecution() {
s.Nil(err)
s.NotNil(completedEvent)
completedAttributes := completedEvent.ChildWorkflowExecutionCompletedEventAttributes
s.Equal(s.domainName, *completedAttributes.Domain)
s.Nil(completedAttributes.Domain)
s.Equal(childID, *completedAttributes.WorkflowExecution.WorkflowId)
s.Equal(wtChild, *completedAttributes.WorkflowType.Name)
s.Equal([]byte("Child Done."), completedAttributes.Result)
Expand Down Expand Up @@ -3913,11 +3912,7 @@ func (s *integrationSuite) TestChildWorkflowWithContinueAsNew() {
return []byte(strconv.Itoa(int(continueAsNewCounter))), []*workflow.Decision{{
DecisionType: common.DecisionTypePtr(workflow.DecisionTypeContinueAsNewWorkflowExecution),
ContinueAsNewWorkflowExecutionDecisionAttributes: &workflow.ContinueAsNewWorkflowExecutionDecisionAttributes{
WorkflowType: childWorkflowType,
TaskList: taskList,
Input: buf.Bytes(),
ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100),
TaskStartToCloseTimeoutSeconds: common.Int32Ptr(10),
Input: buf.Bytes(),
},
}}, nil
}
Expand Down Expand Up @@ -3945,12 +3940,8 @@ func (s *integrationSuite) TestChildWorkflowWithContinueAsNew() {
Domain: common.StringPtr(s.domainName),
WorkflowId: common.StringPtr(childID),
WorkflowType: childWorkflowType,
TaskList: taskList,
Input: buf.Bytes(),
ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(200),
TaskStartToCloseTimeoutSeconds: common.Int32Ptr(2),
ChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate),
Control: nil,
ChildPolicy: common.ChildPolicyPtr(workflow.ChildPolicyTerminate),
},
}}, nil
} else if previousStartedEventID > 0 {
Expand Down
1 change: 1 addition & 0 deletions idl/github.com/uber/cadence/shared.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ enum DecisionTaskFailedCause {
RESET_STICKY_TASKLIST,
WORKFLOW_WORKER_UNHANDLED_FAILURE,
BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,
BAD_START_CHILD_EXECUTION_ATTRIBUTES,
}

enum CancelExternalWorkflowExecutionFailedCause {
Expand Down
46 changes: 23 additions & 23 deletions service/history/historyBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (b *historyBuilder) AddStartChildWorkflowExecutionInitiatedEvent(decisionCo
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionStartedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionStartedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID int64) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionStartedEvent(domain, execution, workflowType, initiatedID)

Expand All @@ -369,7 +369,7 @@ func (b *historyBuilder) AddStartChildWorkflowExecutionFailedEvent(initiatedID i
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionCompletedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionCompletedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
completedAttributes *workflow.WorkflowExecutionCompletedEventAttributes) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionCompletedEvent(domain, execution, workflowType, initiatedID, startedID,
Expand All @@ -378,7 +378,7 @@ func (b *historyBuilder) AddChildWorkflowExecutionCompletedEvent(domain string,
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionFailedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionFailedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
failedAttributes *workflow.WorkflowExecutionFailedEventAttributes) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionFailedEvent(domain, execution, workflowType, initiatedID, startedID,
Expand All @@ -387,7 +387,7 @@ func (b *historyBuilder) AddChildWorkflowExecutionFailedEvent(domain string, exe
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionCanceledEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionCanceledEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
canceledAttributes *workflow.WorkflowExecutionCanceledEventAttributes) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionCanceledEvent(domain, execution, workflowType, initiatedID, startedID,
Expand All @@ -396,7 +396,7 @@ func (b *historyBuilder) AddChildWorkflowExecutionCanceledEvent(domain string, e
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionTerminatedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionTerminatedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
terminatedAttributes *workflow.WorkflowExecutionTerminatedEventAttributes) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionTerminatedEvent(domain, execution, workflowType, initiatedID, startedID,
Expand All @@ -405,7 +405,7 @@ func (b *historyBuilder) AddChildWorkflowExecutionTerminatedEvent(domain string,
return b.addEventToHistory(event)
}

func (b *historyBuilder) AddChildWorkflowExecutionTimedOutEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) AddChildWorkflowExecutionTimedOutEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
timedOutAttributes *workflow.WorkflowExecutionTimedOutEventAttributes) *workflow.HistoryEvent {
event := b.newChildWorkflowExecutionTimedOutEvent(domain, execution, workflowType, initiatedID, startedID,
Expand Down Expand Up @@ -772,14 +772,14 @@ func (b *historyBuilder) newStartChildWorkflowExecutionInitiatedEvent(decisionTa
startAttributes *workflow.StartChildWorkflowExecutionDecisionAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeStartChildWorkflowExecutionInitiated)
attributes := &workflow.StartChildWorkflowExecutionInitiatedEventAttributes{}
attributes.Domain = common.StringPtr(*startAttributes.Domain)
attributes.WorkflowId = common.StringPtr(*startAttributes.WorkflowId)
attributes.Domain = startAttributes.Domain
attributes.WorkflowId = startAttributes.WorkflowId
attributes.WorkflowType = startAttributes.WorkflowType
attributes.TaskList = startAttributes.TaskList
attributes.Input = startAttributes.Input
attributes.ExecutionStartToCloseTimeoutSeconds = common.Int32Ptr(*startAttributes.ExecutionStartToCloseTimeoutSeconds)
attributes.TaskStartToCloseTimeoutSeconds = common.Int32Ptr(*startAttributes.TaskStartToCloseTimeoutSeconds)
attributes.ChildPolicy = common.ChildPolicyPtr(*startAttributes.ChildPolicy)
attributes.ExecutionStartToCloseTimeoutSeconds = startAttributes.ExecutionStartToCloseTimeoutSeconds
attributes.TaskStartToCloseTimeoutSeconds = startAttributes.TaskStartToCloseTimeoutSeconds
attributes.ChildPolicy = startAttributes.ChildPolicy
attributes.Control = startAttributes.Control
attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID)
attributes.WorkflowIdReusePolicy = startAttributes.WorkflowIdReusePolicy
Expand All @@ -788,11 +788,11 @@ func (b *historyBuilder) newStartChildWorkflowExecutionInitiatedEvent(decisionTa
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionStartedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionStartedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID int64) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionStarted)
attributes := &workflow.ChildWorkflowExecutionStartedEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
attributes.InitiatedEventId = common.Int64Ptr(initiatedID)
Expand All @@ -818,12 +818,12 @@ func (b *historyBuilder) newStartChildWorkflowExecutionFailedEvent(initiatedID i
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionCompletedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionCompletedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
completedAttributes *workflow.WorkflowExecutionCompletedEventAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionCompleted)
attributes := &workflow.ChildWorkflowExecutionCompletedEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
attributes.InitiatedEventId = common.Int64Ptr(initiatedID)
Expand All @@ -834,12 +834,12 @@ func (b *historyBuilder) newChildWorkflowExecutionCompletedEvent(domain string,
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionFailedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionFailedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
failedAttributes *workflow.WorkflowExecutionFailedEventAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionFailed)
attributes := &workflow.ChildWorkflowExecutionFailedEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
attributes.InitiatedEventId = common.Int64Ptr(initiatedID)
Expand All @@ -851,12 +851,12 @@ func (b *historyBuilder) newChildWorkflowExecutionFailedEvent(domain string, exe
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionCanceledEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionCanceledEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
canceledAttributes *workflow.WorkflowExecutionCanceledEventAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionCanceled)
attributes := &workflow.ChildWorkflowExecutionCanceledEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
attributes.InitiatedEventId = common.Int64Ptr(initiatedID)
Expand All @@ -867,12 +867,12 @@ func (b *historyBuilder) newChildWorkflowExecutionCanceledEvent(domain string, e
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionTerminatedEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionTerminatedEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
terminatedAttributes *workflow.WorkflowExecutionTerminatedEventAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionTerminated)
attributes := &workflow.ChildWorkflowExecutionTerminatedEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
attributes.InitiatedEventId = common.Int64Ptr(initiatedID)
Expand All @@ -882,12 +882,12 @@ func (b *historyBuilder) newChildWorkflowExecutionTerminatedEvent(domain string,
return historyEvent
}

func (b *historyBuilder) newChildWorkflowExecutionTimedOutEvent(domain string, execution *workflow.WorkflowExecution,
func (b *historyBuilder) newChildWorkflowExecutionTimedOutEvent(domain *string, execution *workflow.WorkflowExecution,
workflowType *workflow.WorkflowType, initiatedID, startedID int64,
timedOutAttributes *workflow.WorkflowExecutionTimedOutEventAttributes) *workflow.HistoryEvent {
historyEvent := b.msBuilder.createNewHistoryEvent(workflow.EventTypeChildWorkflowExecutionTimedOut)
attributes := &workflow.ChildWorkflowExecutionTimedOutEventAttributes{}
attributes.Domain = common.StringPtr(domain)
attributes.Domain = domain
attributes.TimeoutType = timedOutAttributes.TimeoutType
attributes.WorkflowExecution = execution
attributes.WorkflowType = workflowType
Expand Down
Loading