Skip to content

Commit

Permalink
Test Update error from MultiOps is returned (#6857)
Browse files Browse the repository at this point in the history
## What changed?
<!-- Describe what has changed in this PR -->

Added new test for MultiOps.

## Why?
<!-- Tell your future self why have you made these changes -->

Code path was untested.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
  • Loading branch information
stephanos authored Nov 21, 2024
1 parent e45227d commit 6b23acf
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/update_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4862,9 +4862,6 @@ func (s *UpdateWorkflowSuite) TestUpdateWorkflow_ContinueAsNew_UpdateIsNotCarrie
}

func (s *UpdateWorkflowSuite) TestUpdateWithStart() {
// reset reuse minimal interval to allow workflow termination
s.OverrideDynamicConfig(dynamicconfig.WorkflowIdReuseMinimalInterval, 0)

type multiopsResponseErr struct {
response *workflowservice.ExecuteMultiOperationResponse
err error
Expand Down Expand Up @@ -5226,6 +5223,25 @@ func (s *UpdateWorkflowSuite) TestUpdateWithStart() {
}
})
})

s.Run("return update rate limit error", func() {
// lower maximum total number of updates for testing purposes
maxTotalUpdates := 0
cleanup := s.OverrideDynamicConfig(dynamicconfig.WorkflowExecutionMaxTotalUpdates, maxTotalUpdates)
defer cleanup()

tv := testvars.New(s.T())

startReq := startWorkflowReq(tv)
updateReq := s.updateWorkflowRequest(tv,
&updatepb.WaitPolicy{LifecycleStage: enumspb.UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED}, "1")
err := (<-sendUpdateWithStart(testcore.NewContext(), startReq, updateReq)).err
s.Error(err)
errs := err.(*serviceerror.MultiOperationExecution).OperationErrors()
s.Len(errs, 2)
s.Equal("Operation was aborted.", errs[0].Error())
s.Contains(errs[1].Error(), "limit on number of total updates has been reached")
})
}

func (s *UpdateWorkflowSuite) closeShard(wid string) {
Expand Down

0 comments on commit 6b23acf

Please sign in to comment.