diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/B3MultipleHeadersPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/B3MultipleHeadersPropagatorTests.cs index a9ec61e3a0a6..4e19e745c720 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/B3MultipleHeadersPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/B3MultipleHeadersPropagatorTests.cs @@ -183,7 +183,8 @@ public void Extract_IHeadersCollection( Origin = null, SamplingPriority = samplingPriority, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -233,7 +234,8 @@ public void Extract_CarrierAndDelegate( Origin = null, SamplingPriority = samplingPriority, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/B3SingleHeaderPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/B3SingleHeaderPropagatorTests.cs index a2f58a5b4d9c..de40ab6fafe4 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/B3SingleHeaderPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/B3SingleHeaderPropagatorTests.cs @@ -146,7 +146,8 @@ public void Extract_IHeadersCollection(string header, ulong traceIdUpper, ulong Origin = null, SamplingPriority = samplingPriority, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -181,7 +182,8 @@ public void Extract_CarrierAndDelegate(string header, ulong traceIdUpper, ulong Origin = null, SamplingPriority = samplingPriority, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/DatadogPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/DatadogPropagatorTests.cs index bcc318d2bf49..491b15cc829f 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/DatadogPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/DatadogPropagatorTests.cs @@ -229,7 +229,8 @@ public void Extract_IHeadersCollection() SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -259,7 +260,8 @@ public void Extract_CarrierAndDelegate() SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -288,7 +290,8 @@ public void Extract_ReadOnlyDictionary() SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -325,7 +328,8 @@ public void Extract_TraceIdOnly() RawSpanId = "0000000000000000", PropagatedTags = EmptyPropagatedTags, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -397,7 +401,8 @@ public void Extract_InvalidSpanId(string spanId) SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -437,7 +442,8 @@ public void Extract_InvalidSamplingPriority(string samplingPriority, int? expect SamplingPriority = expectedSamplingPriority, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/DistributedPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/DistributedPropagatorTests.cs index 7bd5f8160fb9..727eb24e0fe6 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/DistributedPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/DistributedPropagatorTests.cs @@ -94,7 +94,8 @@ public void Extract_ReadOnlyDictionary() SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, AdditionalW3CTraceState = AdditionalW3CTraceState, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -134,7 +135,8 @@ public void Extract_TraceIdOnly() RawTraceId = RawTraceId, RawSpanId = "0000000000000000", PropagatedTags = EmptyPropagatedTags, - }); + }, + opts => opts.ExcludingMissingMembers()); // TODO: add this to all tests result.Baggage.Should().BeNull(); @@ -220,7 +222,8 @@ public void Extract_InvalidSpanId(string spanId) SamplingPriority = SamplingPriority, PropagatedTags = PropagatedTagsCollection, AdditionalW3CTraceState = AdditionalW3CTraceState, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -261,7 +264,8 @@ public void Extract_InvalidSamplingPriority(string samplingPriority, int? expect SamplingPriority = expectedSamplingPriority, PropagatedTags = PropagatedTagsCollection, AdditionalW3CTraceState = AdditionalW3CTraceState, - }); + }, + opts => opts.ExcludingMissingMembers()); } private static Mock> SetupMockReadOnlyDictionary() diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs index d98b4d0d7b25..12bfd7a88d8c 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/MultiSpanContextPropagatorTests.cs @@ -365,7 +365,8 @@ public void Extract_B3_IHeadersCollection() Origin = null, SamplingPriority = SamplingPriorityValues.AutoKeep, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -397,7 +398,8 @@ public void Extract_B3SingleHeader_IHeadersCollection() Origin = null, SamplingPriority = SamplingPriorityValues.AutoKeep, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -432,7 +434,8 @@ public void Extract_W3C_IHeadersCollection_traceparent() PropagatedTags = EmptyPropagatedTags, IsRemote = true, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -473,7 +476,8 @@ public void Extract_W3C_IHeadersCollection_traceparent_tracestate() ParentId = null, IsRemote = true, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -518,7 +522,8 @@ public void Extract_Datadog_IHeadersCollection() SamplingPriority = SamplingPriorityValues.AutoKeep, PropagatedTags = PropagatedTagsCollection, IsRemote = true, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -680,7 +685,8 @@ public void TraceContextPrecedence_Respected_WhenHavingMatchingTraceIds(bool ext ParentId = null, IsRemote = true, LastParentId = w3CHeaderFirst ? "0123456789abcdef" : null, // if we have Datadog headers don't use p - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -734,7 +740,8 @@ public void TraceContextPrecedence_Correct_WithDifferentTracestate(bool extractF ParentId = null, IsRemote = true, LastParentId = w3CHeaderFirst ? "0123456789abcdef" : null, // if we have Datadog headers don't use p - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -788,7 +795,8 @@ public void TraceContextPrecedence_ExtractedState_WhenMissingDD_OnTracestate(boo ParentId = null, IsRemote = true, LastParentId = w3CHeaderFirst ? ZeroLastParentId : null, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -844,7 +852,8 @@ public void TraceContextPrecedence_ConsistentBehaviour_WithDifferentParentId(boo ParentId = null, IsRemote = true, LastParentId = expectW3cParentIds ? "0123456789abcdef" : null, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -902,7 +911,8 @@ public void TraceContextPrecedence_ConsistentBehaviour_WithDifferentTraceIds(boo ParentId = null, IsRemote = true, LastParentId = w3CHeaderFirst ? ZeroLastParentId : null, - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeEquivalentTo(new Baggage([new KeyValuePair("usr", "customer")])); } diff --git a/tracer/test/Datadog.Trace.Tests/Propagators/W3CTraceContextPropagatorTests.cs b/tracer/test/Datadog.Trace.Tests/Propagators/W3CTraceContextPropagatorTests.cs index 3e59c8f44173..29cae9593458 100644 --- a/tracer/test/Datadog.Trace.Tests/Propagators/W3CTraceContextPropagatorTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Propagators/W3CTraceContextPropagatorTests.cs @@ -370,7 +370,8 @@ public void Extract_IHeadersCollection() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -417,7 +418,8 @@ public void Extract_IHeadersCollection_HandlesMultipleEmptyTraceState(params str Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -456,7 +458,8 @@ public void Extract_CarrierAndDelegate() Parent = null, ParentId = null, LastParentId = ZeroLastParentId - }); + }, + opts => opts.ExcludingMissingMembers()); result.Baggage.Should().BeNull(); } @@ -531,7 +534,8 @@ public void Extract_Multiple_TraceState() Parent = null, ParentId = null, LastParentId = "0123456789abcdef", - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -570,7 +574,8 @@ public void Extract_No_TraceState() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -707,7 +712,8 @@ public void Extract_MatchingSampled1_UsesTracestateSamplingPriority(int sampling Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Theory] @@ -749,7 +755,8 @@ public void Extract_MatchingSampled0_UsesTracestateSamplingPriority(int sampling Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -793,7 +800,8 @@ public void Extract_MismatchingSampled1_UsesSamplingPriorityOf1() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -837,7 +845,8 @@ public void Extract_MismatchingSampled1_Resets_DecisionMaker() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -876,7 +885,8 @@ public void Extract_MismatchingSampled0_UsesSamplingPriorityOf0() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -915,7 +925,8 @@ public void Extract_MismatchingSampled0_Resets_DecisionMaker() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -954,7 +965,8 @@ public void Extract_Sampled1_MissingSamplingPriority_UsesSamplingPriorityOf1() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } [Fact] @@ -993,7 +1005,8 @@ public void Extract_Sampled0_MissingSamplingPriority_UsesSamplingPriorityOf0() Parent = null, ParentId = null, LastParentId = ZeroLastParentId, - }); + }, + opts => opts.ExcludingMissingMembers()); } } } diff --git a/tracer/test/Directory.Build.props b/tracer/test/Directory.Build.props index 022ba418e91e..59548a3e48a3 100644 --- a/tracer/test/Directory.Build.props +++ b/tracer/test/Directory.Build.props @@ -18,7 +18,11 @@ - + + + all + runtime; build; native; contentfiles; analyzers + diff --git a/tracer/test/test-applications/integrations/Samples.InstrumentedTests/Samples.InstrumentedTests.csproj b/tracer/test/test-applications/integrations/Samples.InstrumentedTests/Samples.InstrumentedTests.csproj index dca88942d555..6bac0d823f87 100644 --- a/tracer/test/test-applications/integrations/Samples.InstrumentedTests/Samples.InstrumentedTests.csproj +++ b/tracer/test/test-applications/integrations/Samples.InstrumentedTests/Samples.InstrumentedTests.csproj @@ -31,7 +31,7 @@ - +