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

Add integration tests for eager workflow start #3928

Merged
merged 4 commits into from
Feb 10, 2023

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Feb 9, 2023

I realized that most of the E2E tests I wrote for this in the features repo should actually be integration tests.

@bergundy bergundy self-assigned this Feb 9, 2023
@bergundy bergundy marked this pull request as ready for review February 9, 2023 23:46
@bergundy bergundy requested a review from a team as a code owner February 9, 2023 23:46
@yiminc yiminc merged commit 2117c81 into temporalio:master Feb 10, 2023
Comment on lines +80 to +107
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
}
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *integrationSuite) startEagerWorkflow(baseOptions workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse {
func (s *integrationSuite) startEagerWorkflow(baseRequest *workflowservice.StartWorkflowExecutionRequest) *workflowservice.StartWorkflowExecutionResponse {

Comment on lines +42 to +49
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}
}
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options := baseOptions
request := &workflowservice.StartWorkflowExecutionRequest{}
*request := *baseRequest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants