From d64a51b27b86dfce054d9662c0fac3c74b480410 Mon Sep 17 00:00:00 2001 From: Carly de Frondeville Date: Fri, 29 Nov 2024 18:31:17 -0800 Subject: [PATCH] test child workflow inherit --- common/testing/testvars/test_vars.go | 13 ------------ tests/child_workflow_test.go | 31 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/common/testing/testvars/test_vars.go b/common/testing/testvars/test_vars.go index 180a0865e7d..1e4d6728a2d 100644 --- a/common/testing/testvars/test_vars.go +++ b/common/testing/testvars/test_vars.go @@ -25,7 +25,6 @@ package testvars import ( - deploymentpb "go.temporal.io/api/deployment/v1" "strings" "sync" "time" @@ -213,18 +212,6 @@ func (tv *TestVars) WithTaskQueue(taskQueue string, key ...string) *TestVars { return tv.cloneSet("task_queue", key, taskQueue) } -func (tv *TestVars) WithBuildId(buildId string, key ...string) *TestVars { - return tv.cloneSet("build_id", key, buildId) -} - -func (tv *TestVars) Deployment(key ...string) *deploymentpb.Deployment { - //revive:disable-next-line:unchecked-type-assertion - return &deploymentpb.Deployment{ - SeriesName: tv.DeploymentSeries(key...), - BuildId: tv.BuildId(key...), - } -} - func (tv *TestVars) StickyTaskQueue(key ...string) *taskqueuepb.TaskQueue { return &taskqueuepb.TaskQueue{ Name: tv.getOrCreate("sticky_task_queue", key).(string), diff --git a/tests/child_workflow_test.go b/tests/child_workflow_test.go index b5f11a60f13..5d12d796899 100644 --- a/tests/child_workflow_test.go +++ b/tests/child_workflow_test.go @@ -62,8 +62,7 @@ type ChildWorkflowSuite struct { func (s *ChildWorkflowSuite) SetupSuite() { dynamicConfigOverrides := map[dynamicconfig.Key]any{ - dynamicconfig.FrontendEnableDeployments.Key(): true, - dynamicconfig.WorkerEnableDeployment.Key(): true, + dynamicconfig.EnableDeployments.Key(): true, dynamicconfig.FrontendEnableWorkerVersioningWorkflowAPIs.Key(): true, dynamicconfig.MatchingForwarderMaxChildrenPerNode.Key(): partitionTreeDegree, @@ -84,10 +83,6 @@ func (s *ChildWorkflowSuite) TearDownSuite() { s.FunctionalTestBase.TearDownSuite() } -//func (s *ChildWorkflowSuite) SetupTest() { -// s.FunctionalTestBase.SetupTest() -//} - func TestChildWorkflowSuite(t *testing.T) { t.Parallel() suite.Run(t, new(ChildWorkflowSuite)) @@ -414,12 +409,16 @@ func (s *ChildWorkflowSuite) testChildWorkflowExecution(override *workflowpb.Ver s.Nil(parentStartedEventAttrs.GetRootWorkflowExecution()) // Process ChildExecution Started event and Process Child Execution and complete it - _, err = pollerParent.PollAndHandleWorkflowTask(parentTV, wtHandlerParent) + _, err = pollerParent.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(parentTV, wtHandlerParent) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) // Process Child workflow to start grandchild execution - _, err = pollerChild.PollAndHandleWorkflowTask(childTV, wtHandlerChild) + _, err = pollerChild.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(childTV, wtHandlerChild) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) s.NotNil(childStartedEventFromParent) @@ -458,12 +457,16 @@ func (s *ChildWorkflowSuite) testChildWorkflowExecution(override *workflowpb.Ver s.checkDescribeWorkflowAfterOverride(&commonpb.WorkflowExecution{WorkflowId: childID, RunId: childRunID}, override) // Process GrandchildExecution Started event and Process Grandchild Execution and complete it - _, err = pollerChild.PollAndHandleWorkflowTask(childTV, wtHandlerChild) + _, err = pollerChild.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(childTV, wtHandlerChild) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) // Process Grandchild workflow - _, err = pollerGrandchild.PollAndHandleWorkflowTask(grandchildTV, wtHandlerGrandchild) + _, err = pollerGrandchild.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(grandchildTV, wtHandlerGrandchild) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) s.True(grandchildComplete) @@ -482,13 +485,17 @@ func (s *ChildWorkflowSuite) testChildWorkflowExecution(override *workflowpb.Ver s.ProtoEqual(override, grandchildStartedEventAttrs.GetVersioningOverride()) // Process GrandchildExecution completed event and complete child execution - _, err = pollerChild.PollAndHandleWorkflowTask(childTV, wtHandlerChild) + _, err = pollerChild.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(childTV, wtHandlerChild) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) s.True(childComplete) // Process ChildExecution completed event and complete parent execution - _, err = pollerParent.PollAndHandleWorkflowTask(parentTV, wtHandlerParent) + _, err = pollerParent.PollWorkflowTask( + &workflowservice.PollWorkflowTaskQueueRequest{WorkerVersionCapabilities: versionCap}, + ).HandleTask(parentTV, wtHandlerParent) s.Logger.Info("PollAndHandleWorkflowTask", tag.Error(err)) s.NoError(err) s.NotNil(childCompletedEventFromParent)