@@ -373,9 +373,18 @@ public class InfoWorkflow
373373 public Task < WorkflowInfo > RunAsync ( ) => Task . FromResult ( Workflow . Info ) ;
374374 }
375375
376+ [ Workflow ]
377+ public class InfoFromChildWorkflow
378+ {
379+ [ WorkflowRun ]
380+ public Task < WorkflowInfo > RunAsync ( ) =>
381+ Workflow . ExecuteChildWorkflowAsync ( ( InfoWorkflow wf ) => wf . RunAsync ( ) ) ;
382+ }
383+
376384 [ Fact ]
377385 public async Task ExecuteWorkflowAsync_Info_Succeeds ( )
378386 {
387+ // Normal info
379388 await ExecuteWorkerAsync < InfoWorkflow > ( async worker =>
380389 {
381390 var handle = await Env . Client . StartWorkflowAsync (
@@ -389,6 +398,7 @@ await ExecuteWorkerAsync<InfoWorkflow>(async worker =>
389398 Assert . Equal ( worker . Client . Options . Namespace , result . Namespace ) ;
390399 Assert . Null ( result . Parent ) ;
391400 Assert . Null ( result . RetryPolicy ) ;
401+ Assert . Null ( result . Root ) ;
392402 Assert . Equal ( handle . ResultRunId , result . RunId ) ;
393403 Assert . Null ( result . RunTimeout ) ;
394404 Assert . InRange (
@@ -401,6 +411,22 @@ await ExecuteWorkerAsync<InfoWorkflow>(async worker =>
401411 Assert . Equal ( handle . Id , result . WorkflowId ) ;
402412 Assert . Equal ( "InfoWorkflow" , result . WorkflowType ) ;
403413 } ) ;
414+ // Child info
415+ await ExecuteWorkerAsync < InfoFromChildWorkflow > (
416+ async worker =>
417+ {
418+ var handle = await Env . Client . StartWorkflowAsync (
419+ ( InfoFromChildWorkflow wf ) => wf . RunAsync ( ) ,
420+ new ( id : $ "workflow-{ Guid . NewGuid ( ) } ", taskQueue : worker . Options . TaskQueue ! ) ) ;
421+ var result = await handle . GetResultAsync ( ) ;
422+ Assert . Equal (
423+ new WorkflowInfo . ParentInfo ( Env . Client . Options . Namespace , handle . ResultRunId ! , handle . Id ) ,
424+ result . Parent ) ;
425+ Assert . Equal (
426+ new WorkflowInfo . RootInfo ( handle . ResultRunId ! , handle . Id ) ,
427+ result . Root ) ;
428+ } ,
429+ new TemporalWorkerOptions ( ) . AddWorkflow < InfoWorkflow > ( ) ) ;
404430 }
405431
406432 public record HistoryInfo ( int HistoryLength , int HistorySize , bool ContinueAsNewSuggested ) ;
0 commit comments