-
Notifications
You must be signed in to change notification settings - Fork 917
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
Add integration tests for eager workflow start #3928
Add integration tests for eager workflow start #3928
Conversation
2cbe390
to
fee959d
Compare
func (s *integrationSuite) respondWorkflowTaskCompleted(task *workflowservice.PollWorkflowTaskQueueResponse, result interface{}) { | ||
dataConverter := converter.GetDefaultDataConverter() | ||
payloads, err := dataConverter.ToPayloads(result) | ||
s.Require().NoError(err) | ||
completion := workflowservice.RespondWorkflowTaskCompletedRequest{ | ||
Namespace: s.namespace, | ||
Identity: "test", | ||
TaskToken: task.TaskToken, | ||
Commands: []*commandpb.Command{{CommandType: enumspb.COMMAND_TYPE_COMPLETE_WORKFLOW_EXECUTION, Attributes: &commandpb.Command_CompleteWorkflowExecutionCommandAttributes{ | ||
CompleteWorkflowExecutionCommandAttributes: &commandpb.CompleteWorkflowExecutionCommandAttributes{ | ||
Result: payloads, | ||
}, | ||
}}}, | ||
} | ||
_, err = s.engine.RespondWorkflowTaskCompleted(NewContext(), &completion) | ||
s.Require().NoError(err) | ||
} | ||
|
||
func (s *integrationSuite) pollWorkflowTaskQueue() *workflowservice.PollWorkflowTaskQueueResponse { | ||
task, err := s.engine.PollWorkflowTaskQueue(NewContext(), &workflowservice.PollWorkflowTaskQueueRequest{ | ||
Namespace: s.namespace, | ||
TaskQueue: s.defaultTaskQueue(), | ||
Identity: "test", | ||
}) | ||
s.Require().NotNil(task, "PollWorkflowTaskQueue response was empty") | ||
s.Require().NoError(err) | ||
return task | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other tests use TaskPoller
which does the same thing. Can you use it too?
return &taskqueuepb.TaskQueue{Name: name, Kind: enumspb.TASK_QUEUE_KIND_NORMAL} | ||
} | ||
|
||
func (s *integrationSuite) startEagerWorkflow(baseOptions workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func (s *integrationSuite) startEagerWorkflow(baseOptions workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse { | |
func (s *integrationSuite) startEagerWorkflow(baseRequest *workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse { |
func (s *integrationSuite) defaultWorkflowID() string { | ||
return fmt.Sprintf("integration-%v", s.T().Name()) | ||
} | ||
|
||
func (s *integrationSuite) defaultTaskQueue() *taskqueuepb.TaskQueue { | ||
name := fmt.Sprintf("integration-queue-%v", s.T().Name()) | ||
return &taskqueuepb.TaskQueue{Name: name, Kind: enumspb.TASK_QUEUE_KIND_NORMAL} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth to move this to integrationbase.go
. We should use them everywhere.
} | ||
|
||
func (s *integrationSuite) startEagerWorkflow(baseOptions workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse { | ||
options := baseOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options := baseOptions | |
request := &workflowservice.StartWorkflowExecutionRequest{} | |
*request := *baseRequest |
I realized that most of the E2E tests I wrote for this in the features repo should actually be integration tests.