Skip to content

Commit

Permalink
Adding a new test for ListOpenWorkflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrotx committed Jun 22, 2024
1 parent eb51479 commit 6c4611f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions internal/internal_workflow_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,55 @@ func (s *workflowClientTestSuite) TestTerminateWorkflow() {
s.NoError(err)
}

func (s *workflowClientTestSuite) TestListOpenWorkflow() {
testcases := []struct {
name string
request *shared.ListOpenWorkflowExecutionsRequest
// both error and response should be returned as-is
err error
response *shared.ListOpenWorkflowExecutionsResponse
}{
{
name: "success with domain-name",
request: &shared.ListOpenWorkflowExecutionsRequest{
Domain: common.StringPtr(domain),
},
err: nil,
response: &shared.ListOpenWorkflowExecutionsResponse{},
},
{
// domain name should be taken from workflow client
name: "success without domain-name",
request: &shared.ListOpenWorkflowExecutionsRequest{},
err: nil,
response: &shared.ListOpenWorkflowExecutionsResponse{},
},
{
name: "failed RPC",
request: &shared.ListOpenWorkflowExecutionsRequest{
Domain: common.StringPtr(domain),
},
err: &shared.AccessDeniedError{},
response: nil,
},
}

for _, tt := range testcases {
s.Run(tt.name, func() {
s.service.EXPECT().
ListOpenWorkflowExecutions(gomock.Any(), gomock.Any(), gomock.Any()).
Do(func(_ context.Context, req *shared.ListOpenWorkflowExecutionsRequest, _ ...yarpc.CallOption) {
s.Equal(domain, *req.Domain)
}).
Return(tt.response, tt.err)

resp, err := s.client.ListOpenWorkflow(context.Background(), tt.request)
s.Equal(tt.err, err)
s.Equal(tt.response, resp)
})
}
}

func (s *workflowClientTestSuite) TestGetWorkflowHistory() {
// Page 1 of 2
//// Events
Expand Down

0 comments on commit 6c4611f

Please sign in to comment.