Skip to content

Commit

Permalink
Tidy up tests
Browse files Browse the repository at this point in the history
Since `testify/assert` was brought in by previous change, use it across
all bridge tests.

Signed-off-by: Bryan Boreham <[email protected]>
  • Loading branch information
bboreham committed Apr 18, 2022
1 parent 19a7594 commit 205fd52
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions bridge/opentracing/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package opentracing

import (
"reflect"
"sort"
"testing"

Expand Down Expand Up @@ -70,21 +69,15 @@ func testBridgeWithCarrier(t *testing.T, carrier interface{}) {
defer span.Finish()

err := bridgeTracer.Inject(span.Context(), ot.HTTPHeaders, carrier)
if err != nil {
t.Errorf("Inject error: %s", err)
}
assert.NoError(t, err, "Inject")

extractedSpanContext, err := bridgeTracer.Extract(ot.HTTPHeaders, carrier)
if err != nil {
t.Errorf("Extract error: %s", err)
}
assert.NoError(t, err, "Extract")

// Make a copy of the SpanContext with remote set to true
originalSpanContext := span.Context().(*bridgeSpanContext)
copySpanContext := *originalSpanContext
copySpanContext.otelSpanContext = copySpanContext.otelSpanContext.WithRemote(true)
// Now the copy should be equal to the original we passed in.
if !reflect.DeepEqual(&copySpanContext, extractedSpanContext) {
t.Errorf("Extracted span context does not match: %#v, %#v", span.Context(), extractedSpanContext)
}
assert.Equal(t, &copySpanContext, extractedSpanContext)
}

0 comments on commit 205fd52

Please sign in to comment.