From 6b23acf6b9f36378be82d81bb77b82fb5de0a8e2 Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Thu, 21 Nov 2024 11:14:34 -0800 Subject: [PATCH] Test Update error from MultiOps is returned (#6857) ## What changed? Added new test for MultiOps. ## Why? Code path was untested. ## How did you test it? ## Potential risks ## Documentation ## Is hotfix candidate? --- tests/update_workflow_test.go | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/update_workflow_test.go b/tests/update_workflow_test.go index 133fdcf8a57..294d77973c6 100644 --- a/tests/update_workflow_test.go +++ b/tests/update_workflow_test.go @@ -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 @@ -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) {