Skip to content

Commit

Permalink
Fix schedule workflow unit test (#5052)
Browse files Browse the repository at this point in the history
**What changed?**
Fix unit tests on release branch

**Why?**
The tests assumed that the change to not track ALLOW_ALL workflows was
already active, but it's not on the release branch. So we just need
mocks for WatchWorkflow.

**How did you test it?**
is tests
  • Loading branch information
dnr committed Oct 31, 2023
1 parent 2320fc1 commit ef3b92b
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 ef3b92b

Please sign in to comment.