@@ -3,6 +3,7 @@ package tests
33import (
44 "fmt"
55 "sort"
6+ "strings"
67 "testing"
78 "time"
89
@@ -1244,3 +1245,81 @@ func (s *ChildWorkflowSuite) TestStartChildWorkflowWithInternalTaskQueue_Blocked
12441245 }
12451246 s .True (foundTaskFailed , "WorkflowTaskFailed event should be recorded" )
12461247}
1248+
1249+ func (s * ChildWorkflowSuite ) TestStartChildWorkflowWithMaxLengthWorkflowID () {
1250+ parentID := testcore .RandomizeStr (s .T ().Name ())
1251+ childID := strings .Repeat ("w" , 1000 )
1252+ wtParent := "test-child-workflow-max-id-parent-type"
1253+ wtChild := "test-child-workflow-max-id-child-type"
1254+ tlParent := "test-child-workflow-max-id-parent-taskqueue"
1255+ tlChild := "test-child-workflow-max-id-child-taskqueue"
1256+ identity := "worker1"
1257+
1258+ parentWorkflowType := & commonpb.WorkflowType {Name : wtParent }
1259+ childWorkflowType := & commonpb.WorkflowType {Name : wtChild }
1260+ taskQueueParent := & taskqueuepb.TaskQueue {Name : tlParent , Kind : enumspb .TASK_QUEUE_KIND_NORMAL }
1261+ taskQueueChild := & taskqueuepb.TaskQueue {Name : tlChild , Kind : enumspb .TASK_QUEUE_KIND_NORMAL }
1262+
1263+ request := & workflowservice.StartWorkflowExecutionRequest {
1264+ RequestId : uuid .NewString (),
1265+ Namespace : s .Namespace ().String (),
1266+ WorkflowId : parentID ,
1267+ WorkflowType : parentWorkflowType ,
1268+ TaskQueue : taskQueueParent ,
1269+ Input : nil ,
1270+ WorkflowRunTimeout : durationpb .New (100 * time .Second ),
1271+ WorkflowTaskTimeout : durationpb .New (10 * time .Second ),
1272+ Identity : identity ,
1273+ }
1274+
1275+ we , err := s .FrontendClient ().StartWorkflowExecution (testcore .NewContext (), request )
1276+ s .NoError (err )
1277+ s .Logger .Info ("StartWorkflowExecution" , tag .WorkflowRunID (we .RunId ))
1278+
1279+ childExecutionStarted := false
1280+ wtHandlerParent := func (task * workflowservice.PollWorkflowTaskQueueResponse ) (* workflowservice.RespondWorkflowTaskCompletedRequest , error ) {
1281+ for _ , event := range task .GetHistory ().GetEvents () {
1282+ if event .GetEventType () == enumspb .EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED {
1283+ attrs := event .GetChildWorkflowExecutionStartedEventAttributes ()
1284+ s .Equal (childID , attrs .GetWorkflowExecution ().GetWorkflowId ())
1285+ childExecutionStarted = true
1286+ return & workflowservice.RespondWorkflowTaskCompletedRequest {}, nil
1287+ }
1288+ }
1289+
1290+ return & workflowservice.RespondWorkflowTaskCompletedRequest {
1291+ Commands : []* commandpb.Command {{
1292+ CommandType : enumspb .COMMAND_TYPE_START_CHILD_WORKFLOW_EXECUTION ,
1293+ Attributes : & commandpb.Command_StartChildWorkflowExecutionCommandAttributes {
1294+ StartChildWorkflowExecutionCommandAttributes : & commandpb.StartChildWorkflowExecutionCommandAttributes {
1295+ WorkflowId : childID ,
1296+ WorkflowType : childWorkflowType ,
1297+ TaskQueue : taskQueueChild ,
1298+ Input : payloads .EncodeString ("child-workflow-input" ),
1299+ WorkflowRunTimeout : durationpb .New (200 * time .Second ),
1300+ WorkflowTaskTimeout : durationpb .New (2 * time .Second ),
1301+ },
1302+ },
1303+ }},
1304+ }, nil
1305+ }
1306+
1307+ pollerParent := taskpoller .New (s .T (), s .FrontendClient (), s .Namespace ().String ())
1308+ tvParent := testvars .New (s .T ()).WithWorkflowID (parentID ).WithTaskQueue (tlParent )
1309+
1310+ _ , err = pollerParent .PollAndHandleWorkflowTask (tvParent , wtHandlerParent )
1311+ s .NoError (err )
1312+ _ , err = pollerParent .PollAndHandleWorkflowTask (tvParent , wtHandlerParent , taskpoller .WithTimeout (15 * time .Second ))
1313+ s .NoError (err )
1314+ s .True (childExecutionStarted )
1315+
1316+ describeResp , err := s .FrontendClient ().DescribeWorkflowExecution (testcore .NewContext (), & workflowservice.DescribeWorkflowExecutionRequest {
1317+ Namespace : s .Namespace ().String (),
1318+ Execution : & commonpb.WorkflowExecution {
1319+ WorkflowId : childID ,
1320+ },
1321+ })
1322+ s .NoError (err )
1323+ s .Equal (childID , describeResp .GetWorkflowExecutionInfo ().GetExecution ().GetWorkflowId ())
1324+ s .Equal (enumspb .WORKFLOW_EXECUTION_STATUS_RUNNING , describeResp .GetWorkflowExecutionInfo ().GetStatus ())
1325+ }
0 commit comments