@@ -59,10 +59,13 @@ private static async Task RunOptions(Options opts)
5959 // test scenario runs are run in parallel.
6060
6161 var testScenarioTasks = new List < Task > ( ) ;
62- var testsToRun = opts . All ? Enum . GetValues ( typeof ( TestScenario ) ) : new TestScenario [ ] { StringToTestScenario ( opts . Test ) } ;
62+ var testsToRun = opts . All ? Enum . GetValues ( typeof ( TestScenarioName ) ) : new TestScenarioName [ ] { StringToTestScenario ( opts . Test ) } ;
6363
6464 var testParameters = new TestParameters ( ) ;
6565 testParameters . EventHubsConnectionString = eventHubsConnectionString ;
66+ var runAllRoles = ! int . TryParse ( opts . Role , out var roleIndex ) ;
67+ testParameters . JobIndex = roleIndex ;
68+ testParameters . RunAllRoles = runAllRoles ;
6669
6770 var cancellationSource = new CancellationTokenSource ( ) ;
6871 var runDuration = TimeSpan . FromHours ( testParameters . DurationInHours ) ;
@@ -74,7 +77,7 @@ private static async Task RunOptions(Options opts)
7477
7578 try
7679 {
77- foreach ( TestScenario testScenario in testsToRun )
80+ foreach ( TestScenarioName testScenario in testsToRun )
7881 {
7982 var testName = testScenario . ToString ( ) ;
8083 metrics . Client . Context . GlobalProperties [ "TestName" ] = testName ;
@@ -86,31 +89,31 @@ private static async Task RunOptions(Options opts)
8689
8790 switch ( testScenario )
8891 {
89- case TestScenario . BufferedProducerTest :
92+ case TestScenarioName . BufferedProducerTest :
9093 environment . TryGetValue ( EnvironmentVariables . EventHubBufferedProducerTest , out eventHubName ) ;
9194 testParameters . EventHub = PromptForResources ( "Event Hub" , testName , eventHubName , opts . Interactive ) ;
9295
93- var bufferedProducerTest = new BufferedProducerTest ( testParameters , metrics , opts . Role ) ;
96+ var bufferedProducerTest = new BufferedProducerTest ( testParameters , metrics ) ;
9497 testScenarioTasks . Add ( bufferedProducerTest . RunTestAsync ( cancellationSource . Token ) ) ;
9598 break ;
9699
97- case TestScenario . BurstBufferedProducerTest :
100+ case TestScenarioName . BurstBufferedProducerTest :
98101 environment . TryGetValue ( EnvironmentVariables . EventHubBurstBufferedProducerTest , out eventHubName ) ;
99102 testParameters . EventHub = PromptForResources ( "Event Hub" , testName , eventHubName , opts . Interactive ) ;
100103
101- var burstBufferedProducerTest = new BurstBufferedProducerTest ( testParameters , metrics , opts . Role ) ;
104+ var burstBufferedProducerTest = new BurstBufferedProducerTest ( testParameters , metrics ) ;
102105 testScenarioTasks . Add ( burstBufferedProducerTest . RunTestAsync ( cancellationSource . Token ) ) ;
103106 break ;
104107
105- case TestScenario . EventProducerTest :
108+ case TestScenarioName . EventProducerTest :
106109 environment . TryGetValue ( EnvironmentVariables . EventHubEventProducerTest , out eventHubName ) ;
107110 testParameters . EventHub = PromptForResources ( "Event Hub" , testName , eventHubName , opts . Interactive ) ;
108111
109- var eventProducerTest = new EventProducerTest ( testParameters , metrics , opts . Role ) ;
112+ var eventProducerTest = new EventProducerTest ( testParameters , metrics ) ;
110113 testScenarioTasks . Add ( eventProducerTest . RunTestAsync ( cancellationSource . Token ) ) ;
111114 break ;
112115
113- case TestScenario . ProcessorTest :
116+ case TestScenarioName . ProcessorTest :
114117 // Get the Event Hub name for this test
115118 environment . TryGetValue ( EnvironmentVariables . EventHubProcessorTest , out eventHubName ) ;
116119 testParameters . EventHub = PromptForResources ( "Event Hub" , testName , eventHubName , opts . Interactive ) ;
@@ -123,15 +126,15 @@ private static async Task RunOptions(Options opts)
123126 environment . TryGetValue ( EnvironmentVariables . StorageAccountProcessorTest , out storageConnectionString ) ;
124127 testParameters . StorageConnectionString = PromptForResources ( "Storage Account Connection String" , testName , storageConnectionString , opts . Interactive ) ;
125128
126- var processorTest = new ProcessorTest ( testParameters , metrics , opts . Role ) ;
129+ var processorTest = new ProcessorTest ( testParameters , metrics ) ;
127130 testScenarioTasks . Add ( processorTest . RunTestAsync ( cancellationSource . Token ) ) ;
128131 break ;
129132
130- case TestScenario . ConsumerTest :
133+ case TestScenarioName . ConsumerTest :
131134 environment . TryGetValue ( EnvironmentVariables . EventHubBurstBufferedProducerTest , out eventHubName ) ;
132135 testParameters . EventHub = PromptForResources ( "Event Hub" , testName , eventHubName , opts . Interactive ) ;
133136
134- var consumerTest = new ConsumerTest ( testParameters , metrics , opts . Role ) ;
137+ var consumerTest = new ConsumerTest ( testParameters , metrics ) ;
135138 testScenarioTasks . Add ( consumerTest . RunTestAsync ( cancellationSource . Token ) ) ;
136139 break ;
137140 }
@@ -175,20 +178,20 @@ private static async Task RunOptions(Options opts)
175178 }
176179
177180 /// <summary>
178- /// Converts a string into a <see cref="TestScenario "/> value.
181+ /// Converts a string into a <see cref="TestScenarioName "/> value.
179182 /// </summary>
180183 ///
181- /// <param name="testScenario">The string to convert to a <see cref="TestScenario "/>.</param>
184+ /// <param name="testScenario">The string to convert to a <see cref="TestScenarioName "/>.</param>
182185 ///
183- /// <returns>The <see cref="TestScenario "/> of the string input.</returns>
186+ /// <returns>The <see cref="TestScenarioName "/> of the string input.</returns>
184187 ///
185- public static TestScenario StringToTestScenario ( string testScenario ) => testScenario switch
188+ public static TestScenarioName StringToTestScenario ( string testScenario ) => testScenario switch
186189 {
187- "BufferedProducerTest" or "BuffProd" => TestScenario . BufferedProducerTest ,
188- "BurstBufferedProducerTest" or "BurstBuffProd" => TestScenario . BurstBufferedProducerTest ,
189- "EventProducerTest" or "EventProd" => TestScenario . EventProducerTest ,
190- "ProcessorTest" or "Processor" => TestScenario . ProcessorTest ,
191- "ConsumerTest" or "Consumer" => TestScenario . ConsumerTest ,
190+ "BufferedProducerTest" or "BuffProd" => TestScenarioName . BufferedProducerTest ,
191+ "BurstBufferedProducerTest" or "BurstBuffProd" => TestScenarioName . BurstBufferedProducerTest ,
192+ "EventProducerTest" or "EventProd" => TestScenarioName . EventProducerTest ,
193+ "ProcessorTest" or "Processor" => TestScenarioName . ProcessorTest ,
194+ "ConsumerTest" or "Consumer" => TestScenarioName . ConsumerTest ,
192195 _ => throw new ArgumentNullException ( ) ,
193196 } ;
194197
0 commit comments