Skip to content

Commit

Permalink
Fix usages of BeEquivalentTo
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlock committed Jan 9, 2025
1 parent 85a24ca commit 56b405a
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ public void Extract_IHeadersCollection(
Origin = null,
SamplingPriority = samplingPriority,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -233,7 +234,8 @@ public void Extract_CarrierAndDelegate(
Origin = null,
SamplingPriority = samplingPriority,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public void Extract_IHeadersCollection()
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -259,7 +260,8 @@ public void Extract_CarrierAndDelegate()
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -288,7 +290,8 @@ public void Extract_ReadOnlyDictionary()
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -325,7 +328,8 @@ public void Extract_TraceIdOnly()
RawSpanId = "0000000000000000",
PropagatedTags = EmptyPropagatedTags,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -397,7 +401,8 @@ public void Extract_InvalidSpanId(string spanId)
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public void Extract_ReadOnlyDictionary()
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
AdditionalW3CTraceState = AdditionalW3CTraceState,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -220,7 +222,8 @@ public void Extract_InvalidSpanId(string spanId)
SamplingPriority = SamplingPriority,
PropagatedTags = PropagatedTagsCollection,
AdditionalW3CTraceState = AdditionalW3CTraceState,
});
},
opts => opts.ExcludingMissingMembers());
}

[Theory]
Expand Down Expand Up @@ -261,7 +264,8 @@ public void Extract_InvalidSamplingPriority(string samplingPriority, int? expect
SamplingPriority = expectedSamplingPriority,
PropagatedTags = PropagatedTagsCollection,
AdditionalW3CTraceState = AdditionalW3CTraceState,
});
},
opts => opts.ExcludingMissingMembers());
}

private static Mock<IReadOnlyDictionary<string, string>> SetupMockReadOnlyDictionary()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ public void Extract_B3_IHeadersCollection()
Origin = null,
SamplingPriority = SamplingPriorityValues.AutoKeep,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -397,7 +398,8 @@ public void Extract_B3SingleHeader_IHeadersCollection()
Origin = null,
SamplingPriority = SamplingPriorityValues.AutoKeep,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -432,7 +434,8 @@ public void Extract_W3C_IHeadersCollection_traceparent()
PropagatedTags = EmptyPropagatedTags,
IsRemote = true,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -473,7 +476,8 @@ public void Extract_W3C_IHeadersCollection_traceparent_tracestate()
ParentId = null,
IsRemote = true,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -518,7 +522,8 @@ public void Extract_Datadog_IHeadersCollection()
SamplingPriority = SamplingPriorityValues.AutoKeep,
PropagatedTags = PropagatedTagsCollection,
IsRemote = true,
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -788,7 +795,8 @@ public void TraceContextPrecedence_ExtractedState_WhenMissingDD_OnTracestate(boo
ParentId = null,
IsRemote = true,
LastParentId = w3CHeaderFirst ? ZeroLastParentId : null,
});
},
opts => opts.ExcludingMissingMembers());
}

[Theory]
Expand Down Expand Up @@ -844,7 +852,8 @@ public void TraceContextPrecedence_ConsistentBehaviour_WithDifferentParentId(boo
ParentId = null,
IsRemote = true,
LastParentId = expectW3cParentIds ? "0123456789abcdef" : null,
});
},
opts => opts.ExcludingMissingMembers());
}

[Theory]
Expand Down Expand Up @@ -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<string, string>("usr", "customer")]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ public void Extract_IHeadersCollection()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Theory]
Expand Down Expand Up @@ -417,7 +418,8 @@ public void Extract_IHeadersCollection_HandlesMultipleEmptyTraceState(params str
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -456,7 +458,8 @@ public void Extract_CarrierAndDelegate()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId
});
},
opts => opts.ExcludingMissingMembers());

result.Baggage.Should().BeNull();
}
Expand Down Expand Up @@ -531,7 +534,8 @@ public void Extract_Multiple_TraceState()
Parent = null,
ParentId = null,
LastParentId = "0123456789abcdef",
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -570,7 +574,8 @@ public void Extract_No_TraceState()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -707,7 +712,8 @@ public void Extract_MatchingSampled1_UsesTracestateSamplingPriority(int sampling
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Theory]
Expand Down Expand Up @@ -749,7 +755,8 @@ public void Extract_MatchingSampled0_UsesTracestateSamplingPriority(int sampling
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -793,7 +800,8 @@ public void Extract_MismatchingSampled1_UsesSamplingPriorityOf1()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -837,7 +845,8 @@ public void Extract_MismatchingSampled1_Resets_DecisionMaker()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -876,7 +885,8 @@ public void Extract_MismatchingSampled0_UsesSamplingPriorityOf0()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -915,7 +925,8 @@ public void Extract_MismatchingSampled0_Resets_DecisionMaker()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -954,7 +965,8 @@ public void Extract_Sampled1_MissingSamplingPriority_UsesSamplingPriorityOf1()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}

[Fact]
Expand Down Expand Up @@ -993,7 +1005,8 @@ public void Extract_Sampled0_MissingSamplingPriority_UsesSamplingPriorityOf0()
Parent = null,
ParentId = null,
LastParentId = ZeroLastParentId,
});
},
opts => opts.ExcludingMissingMembers());
}
}
}

0 comments on commit 56b405a

Please sign in to comment.