1- using System . Threading ;
1+ using System ;
2+ using System . Threading ;
23using System . Threading . Tasks ;
34using CommandLine ;
45
@@ -19,8 +20,10 @@ class CreateTestCommand : CommandBase
1920 [ Option ( 't' , "title" , Required = false , Default = "Aggregator CLI Test Task" , HelpText = "Title for new Work Item." ) ]
2021 public string Title { get ; set ; }
2122
22- [ Option ( 'l' , "lastLinePattern" , Required = false , Default = @"Executed \'Functions\." , HelpText = "RegEx Pattern identifying last line of logs." ) ]
23- public string LastLinePattern { get ; set ; }
23+ //[Option('l', "lastLinePattern", Required = false, Default = @"Executed \'Functions\.", HelpText = "RegEx Pattern identifying last line of logs.")]
24+ //public string LastLinePattern { get; set; }
25+ [ Option ( 'r' , "rule" , Required = true , HelpText = "Aggregator rule name." ) ]
26+ public string RuleName { get ; set ; }
2427
2528 internal override async Task < int > RunAsync ( CancellationToken cancellationToken )
2629 {
@@ -32,9 +35,13 @@ internal override async Task<int> RunAsync(CancellationToken cancellationToken)
3235 var instances = new AggregatorInstances ( context . Azure , context . Logger , context . Naming ) ;
3336 var boards = new Boards ( context . Devops , context . Logger ) ;
3437
35- var streamTask = instances . StreamLogsAsync ( instance , lastLinePattern : this . LastLinePattern , cancellationToken : cancellationToken ) ;
3638 int id = await boards . CreateWorkItemAsync ( this . Project , this . Title , cancellationToken ) ;
37- streamTask . Wait ( cancellationToken ) ;
39+
40+ // wait for the Event to be processed in AzDO, sent via WebHooks, and the Function to run
41+ Thread . Sleep ( new TimeSpan ( 0 , 2 , 0 ) ) ;
42+
43+ await instances . ReadLogAsync ( instance , this . RuleName , - 1 , cancellationToken : cancellationToken ) ;
44+
3845 return id > 0 ? 0 : 1 ;
3946 }
4047 }
0 commit comments