Skip to content

Commit

Permalink
tracing: Test for context equality instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhicks committed Oct 30, 2024
1 parent 8c06636 commit a85b3f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/tracing/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package tracing_test

import (
"context"
"fmt"
"testing"

"github.com/luno/jettison/jtest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
Expand Down Expand Up @@ -51,8 +51,10 @@ func TestInject(t *testing.T) {
jtest.RequireNil(t, err)

ctx = tracing.Inject(ctx, data)
expected := "context.Background.WithValue(type trace.traceContextKeyType, val <not Stringer>).WithValue(type log.contextKey, val <not Stringer>)"
require.Equal(t, expected, fmt.Sprint(ctx))

sc, ok := tracing.Extract(ctx)
require.True(t, ok)
assert.Equal(t, spanCtx.WithRemote(true), sc)
}

func setup() {
Expand Down

0 comments on commit a85b3f4

Please sign in to comment.