@@ -57,7 +57,7 @@ public async Task TestEventHubsMessageBatchIntegration(string packageVersion, st
5757 using ( var agent = EnvironmentHelper . GetMockAgent ( ) )
5858 using ( await RunSampleAndWaitForExit ( agent , packageVersion : packageVersion ) )
5959 {
60- var spans = await agent . WaitForSpansAsync ( 5 , timeoutInMilliseconds : 30000 ) ;
60+ var spans = await agent . WaitForSpansAsync ( 5 , timeoutInMilliseconds : 30000 , assertExpectedCount : false ) ;
6161
6262 using var s = new AssertionScope ( ) ;
6363
@@ -67,7 +67,7 @@ public async Task TestEventHubsMessageBatchIntegration(string packageVersion, st
6767
6868 createSpans . Should ( ) . HaveCount ( 3 , "Expected 3 TryAdd spans with azure_eventhubs.create operation" ) ;
6969 sendSpans . Should ( ) . HaveCount ( 1 , "Expected 1 SendAsync span with azure_eventhubs.send operation" ) ;
70- receiveSpans . Should ( ) . HaveCount ( 1 , "Expected 1 receive span" ) ;
70+ receiveSpans . Should ( ) . HaveCountGreaterOrEqualTo ( 1 , "Expected at least 1 receive span" ) ;
7171
7272 var individualMessageSpans = createSpans . Where ( s => s . Resource == "samples-eventhubs-hub" ) . ToList ( ) ;
7373 individualMessageSpans . Should ( ) . HaveCount ( 3 , "Expected 3 individual message spans from TryAdd operations" ) ;
@@ -136,15 +136,15 @@ public async Task TestEventHubsMessageBatchIntegrationWithoutBatchLinks(string p
136136 using ( var agent = EnvironmentHelper . GetMockAgent ( ) )
137137 using ( await RunSampleAndWaitForExit ( agent , packageVersion : packageVersion ) )
138138 {
139- var spans = await agent . WaitForSpansAsync ( 2 , timeoutInMilliseconds : 30000 ) ;
139+ var spans = await agent . WaitForSpansAsync ( 2 , timeoutInMilliseconds : 30000 , assertExpectedCount : false ) ;
140140
141141 using var s = new AssertionScope ( ) ;
142142
143143 var sendSpans = spans . Where ( span => span . Name == "azure_eventhubs.send" ) . ToList ( ) ;
144144 var receiveSpans = spans . Where ( span => span . Name == "azure_eventhubs.receive" ) . ToList ( ) ;
145145
146146 sendSpans . Should ( ) . HaveCount ( 1 , "Expected 1 SendAsync span (no individual TryAdd spans when batch links disabled)" ) ;
147- receiveSpans . Should ( ) . HaveCount ( 1 , "Expected 1 receive span" ) ;
147+ receiveSpans . Should ( ) . HaveCountGreaterOrEqualTo ( 1 , "Expected at least 1 receive span" ) ;
148148
149149 foreach ( var span in spans )
150150 {
0 commit comments