Skip to content

Commit

Permalink
Fix tests around status code in tracing (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino authored Dec 15, 2020
1 parent 03d1775 commit 74c4816
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package router
import (
"net/http"
"net/http/httptest"
"strconv"
"testing"

"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -118,7 +119,7 @@ func TestTracing(t *testing.T) {
if assert.Equal(t, 1, len(spans)) {
assert.Equal(t, "some-service", spans[0].Tag(ext.ServiceName))
assert.Equal(t, scene.resourceName, spans[0].Tag(ext.ResourceName))
assert.Equal(t, http.StatusOK, spans[0].Tag(ext.HTTPCode))
assert.Equal(t, strconv.Itoa(http.StatusOK), spans[0].Tag(ext.HTTPCode))
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion tracing/req_tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/http/httptest"
"strconv"
"testing"

"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -87,6 +88,6 @@ func TestTracerSpans(t *testing.T) {
assert.Equal(t, t.Name(), span.Tag(ext.ServiceName))
assert.Equal(t, "some_resource", span.Tag(ext.ResourceName))
assert.Equal(t, http.MethodGet, span.Tag(ext.HTTPMethod))
assert.Equal(t, http.StatusOK, span.Tag(ext.HTTPCode))
assert.Equal(t, strconv.Itoa(http.StatusOK), span.Tag(ext.HTTPCode))
assert.Equal(t, rt.RequestID, span.Tag("http.request_id"))
}

0 comments on commit 74c4816

Please sign in to comment.