Skip to content

Commit

Permalink
Remove warning about non-serializable test data (#6102)
Browse files Browse the repository at this point in the history
## 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 🤷 
<!-- Fixes #{issue} -->

<!-- ⚠️ Note: where possible, please obtain 2 approvals prior to
merging. Unless CODEOWNERS specifies otherwise, for external teams it is
typically best to have one review from a team member, and one review
from apm-dotnet. Trivial changes do not require 2 reviews. -->
  • Loading branch information
bouwkast authored and agocs committed Oct 4, 2024
1 parent 7376508 commit c0c88f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class SpanMetaStructTests
}
};

[MemberData(nameof(Data))]
[MemberData(nameof(Data), DisableDiscoveryEnumeration = true)]
[Theory]
public static void GivenAEncodedSpanWithMetaStruct_WhenDecoding_ThenMetaStructIsCorrectlyDecoded(List<Tuple<string, object?>> dataToEncode)
{
Expand Down
4 changes: 2 additions & 2 deletions tracer/test/Datadog.Trace.Tests/Tagging/ActivityTagsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IActivity5>();
Expand All @@ -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<string, object> expectedTagValues)
{
var activityMock = new Mock<IActivity5>();
Expand Down

0 comments on commit c0c88f4

Please sign in to comment.