replaceAssignmentRule replaces a new versioning assignment rule to the task queue user data. It checks the response and returns the conflict token.
( env *testcore.TestEnv, tq, newBuildID string, idx int32, conflictToken []byte, expectSuccess bool)
| 4451 | // replaceAssignmentRule replaces a new versioning assignment rule to the task queue user data. |
| 4452 | // It checks the response and returns the conflict token. |
| 4453 | func (s *VersioningIntegSuite) replaceAssignmentRule( |
| 4454 | env *testcore.TestEnv, |
| 4455 | tq, newBuildID string, |
| 4456 | idx int32, conflictToken []byte, expectSuccess bool) []byte { |
| 4457 | res, err := env.FrontendClient().UpdateWorkerVersioningRules(s.Context(), &workflowservice.UpdateWorkerVersioningRulesRequest{ |
| 4458 | Namespace: env.Namespace().String(), |
| 4459 | TaskQueue: tq, |
| 4460 | ConflictToken: conflictToken, |
| 4461 | Operation: &workflowservice.UpdateWorkerVersioningRulesRequest_ReplaceAssignmentRule{ |
| 4462 | ReplaceAssignmentRule: &workflowservice.UpdateWorkerVersioningRulesRequest_ReplaceBuildIdAssignmentRule{ |
| 4463 | RuleIndex: idx, |
| 4464 | Rule: &taskqueuepb.BuildIdAssignmentRule{ |
| 4465 | TargetBuildId: newBuildID, |
| 4466 | }, |
| 4467 | }, |
| 4468 | }, |
| 4469 | }) |
| 4470 | if expectSuccess { |
| 4471 | s.NoError(err) |
| 4472 | s.NotNil(res) |
| 4473 | s.Equal(newBuildID, res.GetAssignmentRules()[idx].GetRule().GetTargetBuildId()) |
| 4474 | return res.GetConflictToken() |
| 4475 | } else { |
| 4476 | s.Error(err) |
| 4477 | s.Nil(res) |
| 4478 | return nil |
| 4479 | } |
| 4480 | } |
| 4481 | |
| 4482 | // deleteAssignmentRule deletes the versioning assignment rule at a given index. |
| 4483 | // It checks the response and returns the conflict token. |
no test coverage detected