@@ -39,7 +39,7 @@ func TestContextMeta_crud(t *testing.T) {
3939 assert .ErrorIs (t , err , ErrNotFound )
4040}
4141
42- func TestContextMeta_ErrNoBaggae (t * testing.T ) {
42+ func TestContextMeta_ErrNoBaggage (t * testing.T ) {
4343 t .Parallel ()
4444
4545 ctx := context .Background ()
@@ -157,3 +157,23 @@ func TestMetadata_global(t *testing.T) {
157157 world , _ = baggage3 .Get ("hello" )
158158 assert .Equal (t , "world" , world )
159159}
160+
161+ func TestMetadata_GetOrInjectBaggage (t * testing.T ) {
162+ t .Parallel ()
163+
164+ ctx := context .Background ()
165+ baggage1 , ctx := GetOrInjectBaggage (ctx )
166+ baggage1 .Set ("hello" , "world" )
167+
168+ baggage2 := GetBaggage (ctx )
169+ world , _ := baggage2 .Get ("hello" )
170+ assert .Equal (t , "world" , world )
171+
172+ baggage3 := DefaultMetadata .GetBaggage (ctx )
173+ world , _ = baggage3 .Get ("hello" )
174+ assert .Equal (t , "world" , world )
175+
176+ baggage4 , _ := GetOrInjectBaggage (ctx )
177+ world , _ = baggage4 .Get ("hello" )
178+ assert .Equal (t , "world" , world )
179+ }
0 commit comments