Skip to content

Commit 746a487

Browse files
committed
Add test for extracting from empty Carrier
1 parent fc5a0a6 commit 746a487

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apps/opentelemetry_api/test/otel_propagators_SUITE.erl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ rewrite(_Config) ->
4949
<<"00-10000000000000000000000000000000-1000000000000000-00">>}],
5050
otel_propagator_trace_context:inject(Ctx, [],
5151
fun otel_propagator_text_map:default_carrier_set/3, [])),
52+
?assertMatch([{<<"traceparent">>,
53+
<<"00-10000000000000000000000000000000-1000000000000000-00">>}],
54+
otel_propagator_trace_context:inject(Ctx, [],
55+
fun otel_propagator_text_map:default_carrier_set/3, [])),
5256

5357
?assertMatch([{<<"traceparent">>,
5458
<<"00-10000000000000000000000000000000-1000000000000000-00">>}],
@@ -67,6 +71,12 @@ rewrite(_Config) ->
6771
?assertEqual(RecordingSpanCtx#span_ctx{is_recording=false,
6872
is_remote=true}, otel_tracer:current_span_ctx()),
6973

74+
% should not fail on empty Carrier
75+
?assertMatch(Ctx,
76+
otel_propagator_trace_context:extract(Ctx, [],
77+
fun otel_propagator_text_map:default_carrier_keys/1,
78+
fun otel_propagator_text_map:default_carrier_get/2, [])),
79+
7080
ok.
7181

7282
invalid_span_no_sdk_propagation(_Config) ->

0 commit comments

Comments
 (0)