2020-03-24 07:41:10 +02:00
|
|
|
// Copyright The OpenTelemetry Authors
|
2019-09-23 20:51:32 +02:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-11-13 17:34:24 +02:00
|
|
|
package propagation_test
|
2019-09-23 20:51:32 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
|
2021-02-18 19:59:37 +02:00
|
|
|
"go.opentelemetry.io/otel/attribute"
|
2020-10-09 04:58:56 +02:00
|
|
|
"go.opentelemetry.io/otel/oteltest"
|
2020-11-13 17:34:24 +02:00
|
|
|
"go.opentelemetry.io/otel/propagation"
|
2020-11-07 00:13:31 +02:00
|
|
|
"go.opentelemetry.io/otel/trace"
|
2019-09-23 20:51:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestExtractValidTraceContextFromHTTPReq(t *testing.T) {
|
2020-11-13 17:34:24 +02:00
|
|
|
prop := propagation.TraceContext{}
|
2019-09-23 20:51:32 +02:00
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
header string
|
2020-11-07 00:13:31 +02:00
|
|
|
wantSc trace.SpanContext
|
2019-09-23 20:51:32 +02:00
|
|
|
}{
|
|
|
|
{
|
2019-10-18 00:08:44 +02:00
|
|
|
name: "valid w3cHeader",
|
2019-09-23 20:51:32 +02:00
|
|
|
header: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-23 20:51:32 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
2019-10-18 00:08:44 +02:00
|
|
|
name: "valid w3cHeader and sampled",
|
2019-09-23 20:51:32 +02:00
|
|
|
header: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "future version",
|
|
|
|
header: "02-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "future options with sampled bit set",
|
|
|
|
header: "02-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-09",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "future options with sampled bit cleared",
|
|
|
|
header: "02-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-08",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-23 20:51:32 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "future additional data",
|
|
|
|
header: "02-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-09-XYZxsf09",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
2019-10-08 19:22:15 +02:00
|
|
|
name: "valid b3Header ending in dash",
|
2019-09-23 20:51:32 +02:00
|
|
|
header: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01-",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
2019-10-08 19:22:15 +02:00
|
|
|
name: "future valid b3Header ending in dash",
|
2019-09-23 20:51:32 +02:00
|
|
|
header: "01-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-09-",
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
req, _ := http.NewRequest("GET", "http://example.com", nil)
|
|
|
|
req.Header.Set("traceparent", tt.header)
|
|
|
|
|
|
|
|
ctx := context.Background()
|
2021-02-17 18:04:49 +02:00
|
|
|
ctx = prop.Extract(ctx, propagation.HeaderCarrier(req.Header))
|
2021-03-29 17:55:44 +02:00
|
|
|
gotSc := trace.SpanContextFromContext(ctx)
|
2021-03-09 18:17:29 +02:00
|
|
|
if diff := cmp.Diff(gotSc, tt.wantSc, cmp.Comparer(func(sc, other trace.SpanContext) bool { return sc.Equal(other) })); diff != "" {
|
2019-09-23 20:51:32 +02:00
|
|
|
t.Errorf("Extract Tracecontext: %s: -got +want %s", tt.name, diff)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExtractInvalidTraceContextFromHTTPReq(t *testing.T) {
|
2020-11-07 00:13:31 +02:00
|
|
|
wantSc := trace.SpanContext{}
|
2020-11-13 17:34:24 +02:00
|
|
|
prop := propagation.TraceContext{}
|
2019-09-23 20:51:32 +02:00
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
header string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "wrong version length",
|
|
|
|
header: "0000-00000000000000000000000000000000-0000000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "wrong trace ID length",
|
|
|
|
header: "00-ab00000000000000000000000000000000-cd00000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "wrong span ID length",
|
|
|
|
header: "00-ab000000000000000000000000000000-cd0000000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "wrong trace flag length",
|
|
|
|
header: "00-ab000000000000000000000000000000-cd00000000000000-0100",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "bogus version",
|
|
|
|
header: "qw-00000000000000000000000000000000-0000000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "bogus trace ID",
|
|
|
|
header: "00-qw000000000000000000000000000000-cd00000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "bogus span ID",
|
|
|
|
header: "00-ab000000000000000000000000000000-qw00000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "bogus trace flag",
|
|
|
|
header: "00-ab000000000000000000000000000000-cd00000000000000-qw",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "upper case version",
|
|
|
|
header: "A0-00000000000000000000000000000000-0000000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "upper case trace ID",
|
|
|
|
header: "00-AB000000000000000000000000000000-cd00000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "upper case span ID",
|
|
|
|
header: "00-ab000000000000000000000000000000-CD00000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "upper case trace flag",
|
|
|
|
header: "00-ab000000000000000000000000000000-cd00000000000000-A1",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "zero trace ID and span ID",
|
|
|
|
header: "00-00000000000000000000000000000000-0000000000000000-01",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "trace-flag unused bits set",
|
|
|
|
header: "00-ab000000000000000000000000000000-cd00000000000000-09",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "missing options",
|
|
|
|
header: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty options",
|
|
|
|
header: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
req, _ := http.NewRequest("GET", "http://example.com", nil)
|
|
|
|
req.Header.Set("traceparent", tt.header)
|
|
|
|
|
|
|
|
ctx := context.Background()
|
2021-02-17 18:04:49 +02:00
|
|
|
ctx = prop.Extract(ctx, propagation.HeaderCarrier(req.Header))
|
2021-03-29 17:55:44 +02:00
|
|
|
gotSc := trace.SpanContextFromContext(ctx)
|
2020-12-21 23:11:48 +02:00
|
|
|
if diff := cmp.Diff(gotSc, wantSc, cmp.AllowUnexported(trace.TraceState{})); diff != "" {
|
2019-09-23 20:51:32 +02:00
|
|
|
t.Errorf("Extract Tracecontext: %s: -got +want %s", tt.name, diff)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInjectTraceContextToHTTPReq(t *testing.T) {
|
2020-11-05 18:13:19 +02:00
|
|
|
mockTracer := oteltest.DefaultTracer()
|
2020-11-13 17:34:24 +02:00
|
|
|
prop := propagation.TraceContext{}
|
2019-09-23 20:51:32 +02:00
|
|
|
tests := []struct {
|
|
|
|
name string
|
2020-11-07 00:13:31 +02:00
|
|
|
sc trace.SpanContext
|
2019-09-23 20:51:32 +02:00
|
|
|
wantHeader string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "valid spancontext, sampled",
|
2021-03-09 18:17:29 +02:00
|
|
|
sc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2020-11-07 00:13:31 +02:00
|
|
|
TraceFlags: trace.FlagsSampled,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2020-11-05 18:13:19 +02:00
|
|
|
wantHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-0000000000000002-01",
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "valid spancontext, not sampled",
|
2021-03-09 18:17:29 +02:00
|
|
|
sc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-23 20:51:32 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2020-11-05 18:13:19 +02:00
|
|
|
wantHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-0000000000000003-00",
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
2019-09-25 23:37:36 +02:00
|
|
|
name: "valid spancontext, with unsupported bit set in traceflags",
|
2021-03-09 18:17:29 +02:00
|
|
|
sc: trace.NewSpanContext(trace.SpanContextConfig{
|
2019-09-25 23:37:36 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
|
|
|
TraceFlags: 0xff,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2020-11-05 18:13:19 +02:00
|
|
|
wantHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-0000000000000004-01",
|
2019-09-23 20:51:32 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "invalid spancontext",
|
2020-11-07 00:13:31 +02:00
|
|
|
sc: trace.SpanContext{},
|
2019-09-23 20:51:32 +02:00
|
|
|
wantHeader: "",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
req, _ := http.NewRequest("GET", "http://example.com", nil)
|
|
|
|
ctx := context.Background()
|
|
|
|
if tt.sc.IsValid() {
|
2020-11-07 00:13:31 +02:00
|
|
|
ctx = trace.ContextWithRemoteSpanContext(ctx, tt.sc)
|
2020-02-04 18:55:03 +02:00
|
|
|
ctx, _ = mockTracer.Start(ctx, "inject")
|
2019-09-23 20:51:32 +02:00
|
|
|
}
|
2021-02-17 18:04:49 +02:00
|
|
|
prop.Inject(ctx, propagation.HeaderCarrier(req.Header))
|
2019-09-23 20:51:32 +02:00
|
|
|
|
|
|
|
gotHeader := req.Header.Get("traceparent")
|
|
|
|
if diff := cmp.Diff(gotHeader, tt.wantHeader); diff != "" {
|
|
|
|
t.Errorf("Extract Tracecontext: %s: -got +want %s", tt.name, diff)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-26 09:05:07 +02:00
|
|
|
func TestTraceContextPropagator_GetAllKeys(t *testing.T) {
|
2020-11-13 17:34:24 +02:00
|
|
|
var propagator propagation.TraceContext
|
2020-05-02 21:23:03 +02:00
|
|
|
want := []string{"traceparent", "tracestate"}
|
2020-10-02 21:27:16 +02:00
|
|
|
got := propagator.Fields()
|
2019-09-23 20:51:32 +02:00
|
|
|
if diff := cmp.Diff(got, want); diff != "" {
|
|
|
|
t.Errorf("GetAllKeys: -got +want %s", diff)
|
|
|
|
}
|
|
|
|
}
|
2020-05-02 21:23:03 +02:00
|
|
|
|
|
|
|
func TestTraceStatePropagation(t *testing.T) {
|
2020-11-13 17:34:24 +02:00
|
|
|
prop := propagation.TraceContext{}
|
2021-01-12 21:12:14 +02:00
|
|
|
stateHeader := "tracestate"
|
|
|
|
parentHeader := "traceparent"
|
2021-05-24 16:53:26 +02:00
|
|
|
state, err := oteltest.TraceStateFromKeyValues(attribute.String("key1", "value1"), attribute.String("key2", "value2"))
|
2021-01-12 21:12:14 +02:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Unable to construct expected TraceState: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
headers map[string]string
|
|
|
|
valid bool
|
|
|
|
wantSc trace.SpanContext
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "valid parent and state",
|
|
|
|
headers: map[string]string{
|
|
|
|
parentHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00",
|
|
|
|
stateHeader: "key1=value1,key2=value2",
|
|
|
|
},
|
|
|
|
valid: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2021-01-12 21:12:14 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
|
|
|
TraceState: state,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2021-01-12 21:12:14 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "valid parent, invalid state",
|
|
|
|
headers: map[string]string{
|
|
|
|
parentHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00",
|
|
|
|
stateHeader: "key1=value1,invalid$@#=invalid",
|
|
|
|
},
|
|
|
|
valid: false,
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2021-01-12 21:12:14 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2021-01-12 21:12:14 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "valid parent, malformed state",
|
|
|
|
headers: map[string]string{
|
|
|
|
parentHeader: "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00",
|
|
|
|
stateHeader: "key1=value1,invalid",
|
|
|
|
},
|
|
|
|
valid: false,
|
2021-03-09 18:17:29 +02:00
|
|
|
wantSc: trace.NewSpanContext(trace.SpanContextConfig{
|
2021-01-12 21:12:14 +02:00
|
|
|
TraceID: traceID,
|
|
|
|
SpanID: spanID,
|
2021-03-18 18:05:37 +02:00
|
|
|
Remote: true,
|
2021-03-09 18:17:29 +02:00
|
|
|
}),
|
2021-01-12 21:12:14 +02:00
|
|
|
},
|
|
|
|
}
|
2020-05-02 21:23:03 +02:00
|
|
|
|
2021-01-12 21:12:14 +02:00
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
inReq, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
|
|
|
|
for hk, hv := range tt.headers {
|
|
|
|
inReq.Header.Add(hk, hv)
|
|
|
|
}
|
|
|
|
|
2021-02-17 18:04:49 +02:00
|
|
|
ctx := prop.Extract(context.Background(), propagation.HeaderCarrier(inReq.Header))
|
2021-01-12 21:12:14 +02:00
|
|
|
if diff := cmp.Diff(
|
2021-03-29 17:55:44 +02:00
|
|
|
trace.SpanContextFromContext(ctx),
|
2021-01-12 21:12:14 +02:00
|
|
|
tt.wantSc,
|
2021-02-18 19:59:37 +02:00
|
|
|
cmp.AllowUnexported(attribute.Value{}),
|
2021-01-12 21:12:14 +02:00
|
|
|
cmp.AllowUnexported(trace.TraceState{}),
|
|
|
|
); diff != "" {
|
|
|
|
t.Errorf("Extracted tracestate: -got +want %s", diff)
|
|
|
|
}
|
2020-05-02 21:23:03 +02:00
|
|
|
|
2021-01-12 21:12:14 +02:00
|
|
|
if tt.valid {
|
|
|
|
mockTracer := oteltest.DefaultTracer()
|
|
|
|
ctx, _ = mockTracer.Start(ctx, "inject")
|
|
|
|
outReq, _ := http.NewRequest(http.MethodGet, "http://www.example.com", nil)
|
2021-02-17 18:04:49 +02:00
|
|
|
prop.Inject(ctx, propagation.HeaderCarrier(outReq.Header))
|
2020-05-02 21:23:03 +02:00
|
|
|
|
2021-01-12 21:12:14 +02:00
|
|
|
if diff := cmp.Diff(outReq.Header.Get(stateHeader), tt.headers[stateHeader]); diff != "" {
|
|
|
|
t.Errorf("Propagated tracestate: -got +want %s", diff)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2020-05-02 21:23:03 +02:00
|
|
|
}
|
|
|
|
}
|