mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 12:17:53 +08:00
fix unit testing case for package gtrace
This commit is contained in:
parent
fddc21670a
commit
ff70e54e3e
@ -54,7 +54,7 @@ func TestNewCarrier(t *testing.T) {
|
|||||||
ctx, _ = oteltest.DefaultTracer().Start(ctx, "inject")
|
ctx, _ = oteltest.DefaultTracer().Start(ctx, "inject")
|
||||||
carrier1 := gtrace.NewCarrier()
|
carrier1 := gtrace.NewCarrier()
|
||||||
otel.GetTextMapPropagator().Inject(ctx, carrier1)
|
otel.GetTextMapPropagator().Inject(ctx, carrier1)
|
||||||
t.Assert(carrier1.String(), `{"traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-0000000000000002-01","tracestate":""}`)
|
t.Assert(carrier1.String(), `{"traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-0000000000000002-01"}`)
|
||||||
|
|
||||||
ctx = otel.GetTextMapPropagator().Extract(ctx, carrier1)
|
ctx = otel.GetTextMapPropagator().Extract(ctx, carrier1)
|
||||||
gotSc := trace.SpanContextFromContext(ctx)
|
gotSc := trace.SpanContextFromContext(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user