...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package baggage
16
17 import (
18 "context"
19 "testing"
20
21 "github.com/stretchr/testify/assert"
22
23 "go.opentelemetry.io/otel/internal/baggage"
24 )
25
26 func TestContext(t *testing.T) {
27 ctx := context.Background()
28 assert.Equal(t, Baggage{}, FromContext(ctx))
29
30 b := Baggage{list: baggage.List{"key": baggage.Item{Value: "val"}}}
31 ctx = ContextWithBaggage(ctx, b)
32 assert.Equal(t, b, FromContext(ctx))
33
34 ctx = ContextWithoutBaggage(ctx)
35 assert.Equal(t, Baggage{}, FromContext(ctx))
36 }
37
View as plain text