From c0c88f4191c9bd6b9dbc437dd80ebf2b67cfe05a Mon Sep 17 00:00:00 2001 From: Steven Bouwkamp Date: Tue, 1 Oct 2024 11:00:45 -0400 Subject: [PATCH] Remove warning about non-serializable test data (#6102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary of changes Removes warnings about non-serializable test data ``` Datadog.Trace.Tests: Non-serializable data ('System.Object[]') found for 'Datadog.Trace.Tests.Tagging.ActivityTagsTests.Tags_ShouldBe_PlacedInMetricsOrMeta'; falling back to single test case. ``` ## Reason for change Warnings about `Non-serializable data ('System.Object[]')`. ## Implementation details Ignored them by setting `DisableDiscoveryEnumeration = true` on `MemberData`. ## Test coverage Ran tests locally, warning gone. ## Other details Maybe I could've changed them to have serializable test data 🤷 --- .../Agent/MessagePack/SpanMetaStructTests.cs | 2 +- tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tracer/test/Datadog.Trace.Tests/Agent/MessagePack/SpanMetaStructTests.cs b/tracer/test/Datadog.Trace.Tests/Agent/MessagePack/SpanMetaStructTests.cs index 7bba73810f66..8e0159570dcd 100644 --- a/tracer/test/Datadog.Trace.Tests/Agent/MessagePack/SpanMetaStructTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Agent/MessagePack/SpanMetaStructTests.cs @@ -103,7 +103,7 @@ public class SpanMetaStructTests } }; - [MemberData(nameof(Data))] + [MemberData(nameof(Data), DisableDiscoveryEnumeration = true)] [Theory] public static void GivenAEncodedSpanWithMetaStruct_WhenDecoding_ThenMetaStructIsCorrectlyDecoded(List> dataToEncode) { diff --git a/tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs b/tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs index 30c3e326e59c..ecdedf06decd 100644 --- a/tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs @@ -70,7 +70,7 @@ public enum TagKind // TODO what about an array of object that contains string and numeric objects? [Theory] - [MemberData(nameof(TagData))] + [MemberData(nameof(TagData), DisableDiscoveryEnumeration = true)] public void Tags_ShouldBe_PlacedInMetricsOrMeta(string tagKey, object tagValue, TagKind expectedTagKind) { var activityMock = new Mock(); @@ -97,7 +97,7 @@ public void Tags_ShouldBe_PlacedInMetricsOrMeta(string tagKey, object tagValue, } [Theory] - [MemberData(nameof(ArrayTagData))] + [MemberData(nameof(ArrayTagData), DisableDiscoveryEnumeration = true)] public void ArrayedTags_ShouldBe_PlacedInMeta(string tagKey, object tagValue, TagKind expectedTagKind, Dictionary expectedTagValues) { var activityMock = new Mock();