From 1577eb38cb734d21d0a0dd3e4e66c5c5a821f017 Mon Sep 17 00:00:00 2001 From: NachoEchevarria Date: Fri, 31 Jul 2026 12:43:20 +0200 Subject: [PATCH 1/5] Update MockTracerAgent.cs --- tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs b/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs index c723f69c72ae..187ecf1dc81a 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs @@ -196,10 +196,9 @@ public async Task> WaitForSpansAsync( await Task.Delay(250); } - if (assertExpectedCount) - { - relevantSpans.Should().HaveCountGreaterThanOrEqualTo(count, "because we want to ensure that we don't timeout while waiting for spans from the mock tracer agent"); - } + relevantSpans.Count(s => operationName is null || s.Name == operationName) + .Should() + .Be(count, "because we want to ensure that we don't timeout while waiting for spans from the mock tracer agent"); foreach (var headers in TraceRequestHeaders) { From f17ef45cfb78cd41e21a1fd1007f068f0b4dd255 Mon Sep 17 00:00:00 2001 From: NachoEchevarria Date: Fri, 31 Jul 2026 15:29:06 +0200 Subject: [PATCH 2/5] fix tests --- .../AWS/AwsEventBridgeTests.cs | 2 +- .../AWS/AwsS3Tests.cs | 2 +- .../AWS/AwsStepFunctionsTests.cs | 2 +- .../AWS/DataStreamsMonitoringAwsSqsTests.cs | 2 +- .../AzureFunctionsMessagingTriggerTests.cs | 2 +- .../Elasticsearch5Tests.cs | 4 +-- .../Elasticsearch6Tests.cs | 4 +-- .../Elasticsearch7Tests.cs | 4 +-- .../MongoDbTests.cs | 31 +++++++++++-------- .../MockTracerAgent.cs | 9 ++++-- 10 files changed, 35 insertions(+), 27 deletions(-) diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs index 1b23562c796b..9050c8c2942b 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs @@ -104,7 +104,7 @@ public async Task IntegrationDisabled() using var agent = EnvironmentHelper.GetMockAgent(); using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) { - var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true); + var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true, assertExpectedCount: false); Assert.NotEmpty(spans); spans.Where(s => s.Name.Equals(expectedOperationName)).Should().BeEmpty(); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsS3Tests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsS3Tests.cs index 469347034482..78dfba38b9e6 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsS3Tests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsS3Tests.cs @@ -99,7 +99,7 @@ public async Task IntegrationDisabled() using var agent = EnvironmentHelper.GetMockAgent(); using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) { - var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true); + var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true, assertExpectedCount: false); Assert.NotEmpty(spans); spans.Where(s => s.Name.Equals(expectedOperationName)).Should().BeEmpty(); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsStepFunctionsTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsStepFunctionsTests.cs index 9e5aa0369d8e..504209f5753a 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsStepFunctionsTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsStepFunctionsTests.cs @@ -111,7 +111,7 @@ public async Task IntegrationDisabled() using var agent = EnvironmentHelper.GetMockAgent(); using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) { - var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true); + var spans = await agent.WaitForSpansAsync(1, returnAllOperations: true, assertExpectedCount: false); Assert.NotEmpty(spans); spans.Where(s => s.Name.Equals(expectedOperationName)).Should().BeEmpty(); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/DataStreamsMonitoringAwsSqsTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/DataStreamsMonitoringAwsSqsTests.cs index 7f80ffb4daa8..0a11a5ecf5bc 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/DataStreamsMonitoringAwsSqsTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/DataStreamsMonitoringAwsSqsTests.cs @@ -81,7 +81,7 @@ public async Task SubmitsDsmMetrics(string packageVersion, int batch, int sameTh #else var expectedCount = 9; #endif - var spans = await agent.WaitForSpansAsync(expectedCount); + var spans = await agent.WaitForSpansAsync(expectedCount, assertExpectedCount: false); var sqsSpans = spans.Where( span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk"); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AzureFunctionsMessagingTriggerTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AzureFunctionsMessagingTriggerTests.cs index ae51e922ecc9..4ec9441d7480 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AzureFunctionsMessagingTriggerTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AzureFunctionsMessagingTriggerTests.cs @@ -119,7 +119,7 @@ public async Task EventHubTrigger_SubmitsTrace() expectedExitCode: ExpectedFuncKillExitCode)) { // Wait for at least 7 spans (1 health-check ping + 6 meaningful). - var allSpans = await agent.WaitForSpansAsync(7, timeoutInMilliseconds: 30000, returnAllOperations: true); + var allSpans = await agent.WaitForSpansAsync(7, timeoutInMilliseconds: 30000, returnAllOperations: true, assertExpectedCount: false); // Keep only the two relevant traces: the seeder trace and the trigger trace. // The trigger trace is identified by the manual span, which is only created for // the expected test event. diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs index be94394e128a..5aa18b90f8dc 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs @@ -146,7 +146,7 @@ public async Task SubmitsTraces(string packageVersion, string metadataSchemaVers }); } - var spans = (await agent.WaitForSpansAsync(expected.Count)) + var spans = (await agent.WaitForSpansAsync(expected.Count, assertExpectedCount: false)) .Where(s => s.Type == "elasticsearch") .OrderBy(s => s.Start) .ToList(); @@ -187,7 +187,7 @@ public async Task IntegrationDisabled() using var agent = EnvironmentHelper.GetMockAgent(); using var process = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion); - var spans = (await agent.WaitForSpansAsync(1)).Where(s => s.Type == "elasticsearch").ToList(); + var spans = (await agent.WaitForSpansAsync(1, assertExpectedCount: false)).Where(s => s.Type == "elasticsearch").ToList(); Assert.Empty(spans); await telemetry.AssertIntegrationDisabledAsync(IntegrationId.ElasticsearchNet); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs index 2fdafcf6cef9..ed6fc35d6a46 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs @@ -157,7 +157,7 @@ public async Task SubmitsTraces(string packageVersion, string metadataSchemaVers } } - var spans = (await agent.WaitForSpansAsync(expected.Count)) + var spans = (await agent.WaitForSpansAsync(expected.Count, assertExpectedCount: false)) .Where(s => s.Type == "elasticsearch") .OrderBy(s => s.Start) .ToList(); @@ -204,7 +204,7 @@ public async Task IntegrationDisabled() SetEnvironmentVariable($"DD_TRACE_{nameof(IntegrationId.ElasticsearchNet)}_ENABLED", "false"); using var agent = EnvironmentHelper.GetMockAgent(); using var process = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion); - var spans = (await agent.WaitForSpansAsync(1)).Where(s => s.Type == "elasticsearch").ToList(); + var spans = (await agent.WaitForSpansAsync(1, assertExpectedCount: false)).Where(s => s.Type == "elasticsearch").ToList(); Assert.Empty(spans); await telemetry.AssertIntegrationDisabledAsync(IntegrationId.ElasticsearchNet); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch7Tests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch7Tests.cs index cca42f1d6be7..368f7c4d499b 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch7Tests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch7Tests.cs @@ -152,7 +152,7 @@ public async Task SubmitsTraces(string packageVersion, string metadataSchemaVers } } - var spans = (await agent.WaitForSpansAsync(expected.Count)) + var spans = (await agent.WaitForSpansAsync(expected.Count, assertExpectedCount: false)) .Where(s => s.Type == "elasticsearch") .OrderBy(s => s.Start) .ToList(); @@ -192,7 +192,7 @@ public async Task IntegrationDisabled() SetEnvironmentVariable($"DD_TRACE_{nameof(IntegrationId.ElasticsearchNet)}_ENABLED", "false"); using var agent = EnvironmentHelper.GetMockAgent(); using var process = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion); - var spans = (await agent.WaitForSpansAsync(1)).Where(s => s.Type == "elasticsearch").ToList(); + var spans = (await agent.WaitForSpansAsync(1, assertExpectedCount: false)).Where(s => s.Type == "elasticsearch").ToList(); Assert.Empty(spans); await telemetry.AssertIntegrationDisabledAsync(IntegrationId.ElasticsearchNet); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs index 53141c93fcbb..af0b3b273e11 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs @@ -51,24 +51,29 @@ public async Task SubmitsTraces(string packageVersion, string metadataSchemaVers var isExternalSpan = metadataSchemaVersion == "v0"; var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-mongodb" : EnvironmentHelper.FullSampleName; + var version = string.IsNullOrEmpty(packageVersion) ? null : new Version(packageVersion); + var snapshotSuffix = version switch + { + null => "2_7", // default is version 2.8.0 + { Major: >= 3 } => "3_0", // The default JSON serialization changed in 3.0 + { Major: 2, Minor: >= 15 } => "2_15", // A bunch of stuff was removed in 2.15.0 + { Major: 2, Minor: >= 7 } => "2_7", // default is version 2.8.0 + { Major: 2, Minor: >= 5 } => "2_5", // version 2.5 + 2.6 include additional info on queries compared to 2.2 + { Major: 2, Minor: >= 2 } => "2_2", + _ => "PRE_2_2" + }; + var expectedSpanCount = snapshotSuffix switch + { + "PRE_2_2" => 7, + "2_15" or "3_0" => 19, + _ => 23 + }; using var telemetry = this.ConfigureTelemetry(); using (var agent = EnvironmentHelper.GetMockAgent()) using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) { - var spans = await agent.WaitForSpansAsync(3, 500); - - var version = string.IsNullOrEmpty(packageVersion) ? null : new Version(packageVersion); - var snapshotSuffix = version switch - { - null => "2_7", // default is version 2.8.0 - { Major: >= 3 } => "3_0", // The default JSON serialization changed in 3.0 - { Major: 2, Minor: >= 15 } => "2_15", // A bunch of stuff was removed in 2.15.0 - { Major: 2, Minor: >= 7 } => "2_7", // default is version 2.8.0 - { Major: 2, Minor: >= 5 } => "2_5", // version 2.5 + 2.6 include additional info on queries compared to 2.2 - { Major: 2, Minor: >= 2 } => "2_2", - _ => "PRE_2_2" - }; + var spans = await agent.WaitForSpansAsync(expectedSpanCount, assertExpectedCount: false); var settings = VerifyHelper.GetSpanVerifierSettings(); // mongo stamps the current framework version, and OS so normalise those diff --git a/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs b/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs index 187ecf1dc81a..1acf588142a6 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs @@ -196,9 +196,12 @@ public async Task> WaitForSpansAsync( await Task.Delay(250); } - relevantSpans.Count(s => operationName is null || s.Name == operationName) - .Should() - .Be(count, "because we want to ensure that we don't timeout while waiting for spans from the mock tracer agent"); + if (assertExpectedCount) + { + relevantSpans.Count(s => operationName is null || s.Name == operationName) + .Should() + .Be(count, "because we want to ensure that we don't timeout while waiting for spans from the mock tracer agent"); + } foreach (var headers in TraceRequestHeaders) { From 21e798ac693bf6179e78528dd36f9cf91b5ae0e8 Mon Sep 17 00:00:00 2001 From: NachoEchevarria Date: Fri, 31 Jul 2026 15:33:21 +0200 Subject: [PATCH 3/5] Update DeduplicationTests.cs --- .../IAST/Deduplication/DeduplicationTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/Deduplication/DeduplicationTests.cs b/tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/Deduplication/DeduplicationTests.cs index f78f5a889833..e2dafa4e2894 100644 --- a/tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/Deduplication/DeduplicationTests.cs +++ b/tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/Deduplication/DeduplicationTests.cs @@ -47,6 +47,11 @@ public async Task SubmitsTraces(bool deduplicationEnabled, string disableKey = " SetEnvironmentVariable("DD_APPSEC_STACK_TRACE_ENABLED", "false"); int expectedSpanCount = instrumented ? (deduplicationEnabled ? 2 : 10) : 0; + if (onlyWeakHash) + { + expectedSpanCount /= 2; + } + var filename = deduplicationEnabled ? "iast.deduplication.deduplicated" : "iast.deduplication.duplicated"; if (!onlyWeakHash) From 480f119a959a09c85291a9f3566448cededfc820 Mon Sep 17 00:00:00 2001 From: NachoEchevarria Date: Fri, 31 Jul 2026 17:12:46 +0200 Subject: [PATCH 4/5] fix tets --- .../AdoNet/MicrosoftDataSqlClientTests.cs | 2 +- .../AdoNet/SystemDataSqlClientTests.cs | 2 +- .../Datadog.Trace.ClrProfiler.IntegrationTests/GrpcTests.cs | 2 +- .../Datadog.Trace.ClrProfiler.IntegrationTests/ILoggerTests.cs | 2 +- .../TraceAnnotationsTests.cs | 2 +- .../VersionConflict/ILoggerVersionConflict2xTests.cs | 2 +- .../VersionConflict/Log4NetVersionConflict2xTests.cs | 2 +- .../VersionConflict/NLogVersionConflict2xTests.cs | 2 +- .../VersionConflict/SerilogVersionConflict2xTests.cs | 2 +- .../TestHelper.cs | 3 ++- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs index 829f9cfd4e5a..c525ee3a3606 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs @@ -83,7 +83,7 @@ public async Task IntegrationDisabled() using var telemetry = this.ConfigureTelemetry(); using var agent = EnvironmentHelper.GetMockAgent(); using var process = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion); - var spans = await agent.WaitForSpansAsync(totalSpanCount, returnAllOperations: true); + var spans = await agent.WaitForSpansAsync(totalSpanCount, returnAllOperations: true, assertExpectedCount: false); Assert.NotEmpty(spans); spans.Where(s => s.Name.Equals(expectedOperationName)).Should().BeEmpty(); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs index 2cddaa7f3a29..59e2bb0ab21a 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs @@ -144,7 +144,7 @@ public async Task IntegrationDisabled() using var telemetry = this.ConfigureTelemetry(); using var agent = EnvironmentHelper.GetMockAgent(); using var process = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion); - var spans = await agent.WaitForSpansAsync(totalSpanCount, returnAllOperations: true); + var spans = await agent.WaitForSpansAsync(totalSpanCount, returnAllOperations: true, assertExpectedCount: false); Assert.NotEmpty(spans); spans.Where(s => s.Name.Equals(expectedOperationName)).Should().BeEmpty(); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GrpcTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GrpcTests.cs index 9c637bca1a21..7963a477cfe6 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GrpcTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GrpcTests.cs @@ -450,7 +450,7 @@ protected async Task RunIntegrationDisabled(string packageVersion) { using (processResult = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion, aspNetCorePort: 0)) { - var spans = (await agent.WaitForSpansAsync(1, timeoutInMilliseconds: 500)).Where(s => s.Type == "grpc.request").ToList(); + var spans = (await agent.WaitForSpansAsync(1, timeoutInMilliseconds: 500, assertExpectedCount: false)).Where(s => s.Type == "grpc.request").ToList(); Assert.Empty(spans); await telemetry.AssertIntegrationDisabledAsync(IntegrationId.Grpc); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/ILoggerTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/ILoggerTests.cs index 14630d164648..d6175e90d08c 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/ILoggerTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/ILoggerTests.cs @@ -144,7 +144,7 @@ protected async Task RunLogsInjectionTests(bool enableLogShipping, bool enable12 using (var agent = EnvironmentHelper.GetMockAgent()) using (var processResult = await RunSampleAndWaitForExit(agent, packageVersion: packageVersion, aspNetCorePort: 0)) { - var spans = await agent.WaitForSpansAsync(1, 2500); + var spans = await agent.WaitForSpansAsync(1, 2500, assertExpectedCount: false); spans.Should().HaveCountGreaterOrEqualTo(1); ValidateLogCorrelation(spans, _logFiles, expectedCorrelatedTraceCount, expectedCorrelatedSpanCount, packageVersion: packageVersion, use128Bits: enable128BitInjection); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs index a61a75cd7dfa..bda66e184dc9 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/TraceAnnotationsTests.cs @@ -78,7 +78,7 @@ protected TraceAnnotationsTests(string sampleAppName, bool enableTelemetry, ITes [SkippableFact] public async Task SubmitTraces() { - const int expectedSpanCount = 58; + const int expectedSpanCount = 68; var ddTraceMethodsString = string.Empty; foreach (var type in TestTypes) diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/ILoggerVersionConflict2xTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/ILoggerVersionConflict2xTests.cs index 74c9e7bc9e31..67d875673403 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/ILoggerVersionConflict2xTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/ILoggerVersionConflict2xTests.cs @@ -61,7 +61,7 @@ public async Task InjectsLogs() using (var agent = EnvironmentHelper.GetMockAgent()) using (await RunSampleAndWaitForExit(agent, aspNetCorePort: 0)) { - var spans = await agent.WaitForSpansAsync(1, 2500); + var spans = await agent.WaitForSpansAsync(1, 2500, assertExpectedCount: false); spans.Should().HaveCountGreaterOrEqualTo(1); ValidateLogCorrelation(spans, _logFiles, expectedCorrelatedTraceCount, expectedCorrelatedSpanCount, use128Bits: false); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/Log4NetVersionConflict2xTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/Log4NetVersionConflict2xTests.cs index cc3d9912200e..d0e79344b891 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/Log4NetVersionConflict2xTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/Log4NetVersionConflict2xTests.cs @@ -49,7 +49,7 @@ public async Task InjectsLogsWhenEnabled() using (var agent = MockTracerAgent.Create(Output, agentPort)) using (await RunSampleAndWaitForExit(agent)) { - var spans = await agent.WaitForSpansAsync(1, 2500); + var spans = await agent.WaitForSpansAsync(1, 2500, assertExpectedCount: false); Assert.True(spans.Count >= 1, $"Expecting at least 1 span, only received {spans.Count}"); ValidateLogCorrelation(spans, _nlog205LogFileTests, expectedCorrelatedTraceCount, expectedCorrelatedSpanCount); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/NLogVersionConflict2xTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/NLogVersionConflict2xTests.cs index fd5f73116684..430cc822895e 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/NLogVersionConflict2xTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/NLogVersionConflict2xTests.cs @@ -49,7 +49,7 @@ public async Task InjectsLogsWhenEnabled() using (var agent = MockTracerAgent.Create(Output, agentPort)) using (await RunSampleAndWaitForExit(agent)) { - var spans = await agent.WaitForSpansAsync(1, 2500); + var spans = await agent.WaitForSpansAsync(1, 2500, assertExpectedCount: false); Assert.True(spans.Count >= 1, $"Expecting at least 1 span, only received {spans.Count}"); ValidateLogCorrelation(spans, _nlog40LogFileTests, expectedCorrelatedTraceCount, expectedCorrelatedSpanCount); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/SerilogVersionConflict2xTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/SerilogVersionConflict2xTests.cs index a4f8845c6634..b96c157c805f 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/SerilogVersionConflict2xTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/VersionConflict/SerilogVersionConflict2xTests.cs @@ -49,7 +49,7 @@ public async Task InjectsLogsWhenEnabled() using (var agent = MockTracerAgent.Create(Output, agentPort)) using (await RunSampleAndWaitForExit(agent)) { - var spans = await agent.WaitForSpansAsync(1, 2500); + var spans = await agent.WaitForSpansAsync(1, 2500, assertExpectedCount: false); Assert.True(spans.Count >= 1, $"Expecting at least 1 span, only received {spans.Count}"); ValidateLogCorrelation(spans, _log200FileTests, expectedCorrelatedTraceCount, expectedCorrelatedSpanCount); diff --git a/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs b/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs index 6f7889ffab1d..15f9199b22b3 100644 --- a/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs +++ b/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/TestHelper.cs @@ -555,7 +555,8 @@ protected async Task> GetWebServerSpans( return await agent.WaitForSpansAsync( count: expectedSpanCount, minDateTime: testStart, - returnAllOperations: true); + returnAllOperations: true, + assertExpectedCount: false); } protected async Task AssertWebServerSpan( From a53edea5e25d1607352ff048352a569137c95087 Mon Sep 17 00:00:00 2001 From: NachoEchevarria Date: Mon, 3 Aug 2026 13:01:35 +0200 Subject: [PATCH 5/5] Update AspNetCoreTestFixture.cs --- .../AspNetCoreTestFixture.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/AspNetCoreTestFixture.cs b/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/AspNetCoreTestFixture.cs index e4b7ea5171f0..7d4d9c457648 100644 --- a/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/AspNetCoreTestFixture.cs +++ b/tracer/test/Datadog.Trace.TestHelpers.AutoInstrumentation/AspNetCoreTestFixture.cs @@ -243,7 +243,8 @@ public async Task> WaitForSpans(string path, HttpMethod return await Agent.WaitForSpansAsync( count: 1, minDateTime: now, - returnAllOperations: true); + returnAllOperations: true, + assertExpectedCount: false); } // Returns true when a known race fingerprint was detected in the captured stderr and the