@@ -28,9 +28,9 @@ public async Task EventCountersAndMetricsValues()
2828 // Arrange
2929 var hostingEventSource = new HostingEventSource ( Guid . NewGuid ( ) . ToString ( ) ) ;
3030
31+ // requests-per-second isn't tested because the value can't be reliably tested because of time
3132 using var eventListener = new TestCounterListener ( LoggerFactory , hostingEventSource . Name ,
3233 [
33- "requests-per-second" ,
3434 "total-requests" ,
3535 "current-requests" ,
3636 "failed-requests"
@@ -40,7 +40,6 @@ public async Task EventCountersAndMetricsValues()
4040 using CancellationTokenSource timeoutTokenSource = new CancellationTokenSource ( timeout ) ;
4141 timeoutTokenSource . Token . Register ( ( ) => Logger . LogError ( "Timeout while waiting for counter value." ) ) ;
4242
43- var rpsValues = eventListener . GetCounterValues ( "requests-per-second" , timeoutTokenSource . Token ) . GetAsyncEnumerator ( ) ;
4443 var totalRequestValues = eventListener . GetCounterValues ( "total-requests" , timeoutTokenSource . Token ) . GetAsyncEnumerator ( ) ;
4544 var currentRequestValues = eventListener . GetCounterValues ( "current-requests" , timeoutTokenSource . Token ) . GetAsyncEnumerator ( ) ;
4645 var failedRequestValues = eventListener . GetCounterValues ( "failed-requests" , timeoutTokenSource . Token ) . GetAsyncEnumerator ( ) ;
@@ -64,19 +63,22 @@ public async Task EventCountersAndMetricsValues()
6463 using var requestDurationCollector2 = new MetricCollector < double > ( testMeterFactory2 , HostingMetrics . MeterName , "http.server.request.duration" ) ;
6564
6665 // Act/Assert 1
66+ Logger . LogInformation ( "Act/Assert 1" ) ;
67+ Logger . LogInformation ( nameof ( HostingApplication . CreateContext ) ) ;
68+
6769 var context1 = hostingApplication1 . CreateContext ( features1 ) ;
6870 var context2 = hostingApplication2 . CreateContext ( features2 ) ;
6971
7072 await totalRequestValues . WaitForSumValueAsync ( 2 ) ;
71- await rpsValues . WaitForValueAsync ( 2 ) ;
7273 await currentRequestValues . WaitForValueAsync ( 2 ) ;
7374 await failedRequestValues . WaitForValueAsync ( 0 ) ;
7475
76+ Logger . LogInformation ( nameof ( HostingApplication . DisposeContext ) ) ;
77+
7578 hostingApplication1 . DisposeContext ( context1 , null ) ;
7679 hostingApplication2 . DisposeContext ( context2 , null ) ;
7780
7881 await totalRequestValues . WaitForSumValueAsync ( 2 ) ;
79- await rpsValues . WaitForValueAsync ( 0 ) ;
8082 await currentRequestValues . WaitForValueAsync ( 0 ) ;
8183 await failedRequestValues . WaitForValueAsync ( 0 ) ;
8284
@@ -92,22 +94,25 @@ public async Task EventCountersAndMetricsValues()
9294 m => Assert . True ( m . Value > 0 ) ) ;
9395
9496 // Act/Assert 2
97+ Logger . LogInformation ( "Act/Assert 2" ) ;
98+ Logger . LogInformation ( nameof ( HostingApplication . CreateContext ) ) ;
99+
95100 context1 = hostingApplication1 . CreateContext ( features1 ) ;
96101 context2 = hostingApplication2 . CreateContext ( features2 ) ;
97102
98103 await totalRequestValues . WaitForSumValueAsync ( 4 ) ;
99- await rpsValues . WaitForValueAsync ( 2 ) ;
100104 await currentRequestValues . WaitForValueAsync ( 2 ) ;
101105 await failedRequestValues . WaitForValueAsync ( 0 ) ;
102106
103107 context1 . HttpContext . Response . StatusCode = StatusCodes . Status500InternalServerError ;
104108 context2 . HttpContext . Response . StatusCode = StatusCodes . Status500InternalServerError ;
105109
110+ Logger . LogInformation ( nameof ( HostingApplication . DisposeContext ) ) ;
111+
106112 hostingApplication1 . DisposeContext ( context1 , null ) ;
107113 hostingApplication2 . DisposeContext ( context2 , null ) ;
108114
109115 await totalRequestValues . WaitForSumValueAsync ( 4 ) ;
110- await rpsValues . WaitForValueAsync ( 0 ) ;
111116 await currentRequestValues . WaitForValueAsync ( 0 ) ;
112117 await failedRequestValues . WaitForValueAsync ( 2 ) ;
113118
0 commit comments