Skip to content

Commit

Permalink
Refactor TestBridgeCarrierBaggagePropagation
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Dec 28, 2023
1 parent c02d5d1 commit b4c11fe
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions bridge/opentracing/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,8 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) {
}

testCases := []struct {
name string
baggageItems []bipBaggage
wantBaggageItems []bipBaggage
name string
baggageItems []bipBaggage
}{
{
name: "single baggage item",
Expand All @@ -606,12 +605,6 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) {
value: "bar",
},
},
wantBaggageItems: []bipBaggage{
{
key: "foo",
value: "bar",
},
},
},
{
name: "multiple baggage items",
Expand All @@ -625,16 +618,6 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) {
value: "bar2",
},
},
wantBaggageItems: []bipBaggage{
{
key: "foo",
value: "bar",
},
{
key: "foo2",
value: "bar2",
},
},
},
}

Expand Down Expand Up @@ -664,10 +647,13 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) {
// Check baggage items.
bsc, ok := spanContext.(*bridgeSpanContext)
assert.True(t, ok)
assert.Equal(t, len(tc.wantBaggageItems), bsc.bag.Len())
for _, bi := range tc.wantBaggageItems {
assert.Equal(t, bi.value, bsc.bag.Member(bi.key).Value())

var got []bipBaggage
for _, m := range bsc.bag.Members() {
got = append(got, bipBaggage{m.Key(), m.Value()})
}

assert.Equal(t, tc.baggageItems, got)
})
}
}
Expand Down

0 comments on commit b4c11fe

Please sign in to comment.