Skip to content

Commit

Permalink
update test for gorillamux spans now present
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieDanielson committed May 15, 2023
1 parent 563e234 commit 0361d96
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions test/e2e/gorillamux/verify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,34 @@
load ../../test_helpers/utilities

LIBRARY_NAME="github.com/gorilla/mux"
# TODO: spans currently show net/http as the library name
TEMP_LIBRARY_NAME="net/http"

@test "go-auto :: includes service.name in resource attributes" {
result=$(resource_attributes_received | jq "select(.key == \"service.name\").value.stringValue")
assert_equal "$result" '"sample-app"'
}

@test "${LIBRARY_NAME} :: emits a span name '{http.method} {http.target}' (per semconv)" {
result=$(span_names_for ${TEMP_LIBRARY_NAME})
result=$(span_names_for ${LIBRARY_NAME})
assert_equal "$result" '"GET /users/foo"'
}

@test "${LIBRARY_NAME} :: includes http.method attribute" {
result=$(span_attributes_for ${TEMP_LIBRARY_NAME} | jq "select(.key == \"http.method\").value.stringValue")
result=$(span_attributes_for ${LIBRARY_NAME} | jq "select(.key == \"http.method\").value.stringValue")
assert_equal "$result" '"GET"'
}

@test "${LIBRARY_NAME} :: includes http.target attribute" {
result=$(span_attributes_for ${TEMP_LIBRARY_NAME} | jq "select(.key == \"http.target\").value.stringValue")
result=$(span_attributes_for ${LIBRARY_NAME} | jq "select(.key == \"http.target\").value.stringValue")
assert_equal "$result" '"/users/foo"'
}

@test "${LIBRARY_NAME} :: trace ID present and valid in all spans" {
trace_id=$(spans_from_scope_named ${TEMP_LIBRARY_NAME} | jq ".traceId")
trace_id=$(spans_from_scope_named ${LIBRARY_NAME} | jq ".traceId")
assert_regex "$trace_id" ${MATCH_A_TRACE_ID}
}

@test "${LIBRARY_NAME} :: span ID present and valid in all spans" {
span_id=$(spans_from_scope_named ${TEMP_LIBRARY_NAME} | jq ".spanId")
span_id=$(spans_from_scope_named ${LIBRARY_NAME} | jq ".spanId")
assert_regex "$span_id" ${MATCH_A_SPAN_ID}
}

Expand Down

0 comments on commit 0361d96

Please sign in to comment.