Skip to content

Commit

Permalink
Fix schedule workflow unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dnr committed Oct 31, 2023
1 parent 2320fc1 commit 9c0c3b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions service/worker/scheduler/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,9 @@ func (s *workflowSuite) TestCANByIterations() {
s.Fail("too many starts")
return nil, nil
}).Times(0).Maybe()
s.expectWatch(func(req *schedspb.WatchWorkflowRequest) (*schedspb.WatchWorkflowResponse, error) {
return &schedspb.WatchWorkflowResponse{Status: enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED}, nil
}).Times(0).Maybe()

// this is ignored because we set iters explicitly
s.env.RegisterDelayedCallback(func() {
Expand Down Expand Up @@ -1755,6 +1758,9 @@ func (s *workflowSuite) TestCANBySuggested() {
s.Fail("too many starts", req.Request.WorkflowId)
return nil, nil
}).Times(0).Maybe()
s.expectWatch(func(req *schedspb.WatchWorkflowRequest) (*schedspb.WatchWorkflowResponse, error) {
return &schedspb.WatchWorkflowResponse{Status: enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED}, nil
}).Times(0).Maybe()

s.env.RegisterDelayedCallback(func() {
s.env.SetContinueAsNewSuggested(true)
Expand Down Expand Up @@ -1791,6 +1797,9 @@ func (s *workflowSuite) TestCANBySignal() {
s.Fail("too many starts", req.Request.WorkflowId)
return nil, nil
}).Times(0).Maybe()
s.expectWatch(func(req *schedspb.WatchWorkflowRequest) (*schedspb.WatchWorkflowResponse, error) {
return &schedspb.WatchWorkflowResponse{Status: enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED}, nil
}).Times(0).Maybe()

s.env.RegisterDelayedCallback(func() {
s.env.SignalWorkflow(SignalNameForceCAN, nil)
Expand Down

0 comments on commit 9c0c3b9

Please # to comment.