@@ -20,7 +20,7 @@ public class MetricsEventManagerTests
20
20
{
21
21
private Random _randomNumberGenerator = new Random ( ) ;
22
22
private const int MinimumLongRunningDurationInMs = 2000 ;
23
- private const int MinimumRandomValueForLongRunningDurationInMs = MinimumLongRunningDurationInMs + 200 ;
23
+ private const int MinimumRandomValueForLongRunningDurationInMs = MinimumLongRunningDurationInMs + MinimumLongRunningDurationInMs ;
24
24
25
25
[ Fact ]
26
26
public async Task MetricsEventManager_BasicTest ( )
@@ -48,7 +48,7 @@ public async Task MetricsEventManager_MultipleConcurrentShortFunctionExecutions(
48
48
}
49
49
50
50
await AwaitFunctionTasks ( taskList ) ;
51
- Assert . Equal ( concurrency , argsList . Count ) ;
51
+ ValidateFunctionExecutionEventArgumentsList ( argsList , concurrency ) ;
52
52
}
53
53
54
54
[ Fact ]
@@ -124,7 +124,7 @@ public async Task MetricsEventManager_NonParallelExecutionsShouldHaveDifferentEx
124
124
// Let's make sure that the tracker is not running anymore
125
125
await Task . Delay ( TimeSpan . FromMilliseconds ( MinimumRandomValueForLongRunningDurationInMs ) ) ;
126
126
127
- Assert . True ( argsList [ 0 ] . ExecutionId != argsList [ 1 ] . ExecutionId , "Execution ids are same" ) ;
127
+ Assert . True ( argsList [ 0 ] . ExecutionId != argsList [ argsList . Count - 1 ] . ExecutionId , "Execution ids are same" ) ;
128
128
}
129
129
130
130
private static async Task AwaitFunctionTasks ( List < Task > taskList )
@@ -209,8 +209,8 @@ private static bool ValidateFunctionExecutionEventArgumentsList(List<FunctionExe
209
209
hashes . Add ( lastEvent . InvocationId ) ;
210
210
}
211
211
212
- var minEventsExpected = Math . Floor ( ( double ) lastEvent . ExecutionTimeSpan / ( double ) MinimumLongRunningDurationInMs ) - 1 ;
213
- var maxEventsExpected = Math . Ceiling ( ( double ) lastEvent . ExecutionTimeSpan / ( double ) MinimumLongRunningDurationInMs ) + 1 ;
212
+ var minEventsExpected = Math . Floor ( ( double ) lastEvent . ExecutionTimeSpan / ( double ) MinimumLongRunningDurationInMs ) - 2 ;
213
+ var maxEventsExpected = Math . Ceiling ( ( double ) lastEvent . ExecutionTimeSpan / ( double ) MinimumLongRunningDurationInMs ) + 2 ;
214
214
// We should see atleast one InProgress event if it takes more than 5 seconds
215
215
if ( lastEvent . ExecutionTimeSpan >= MinimumLongRunningDurationInMs
216
216
&& ( relatedEventIds . Count < minEventsExpected
0 commit comments