Skip to content

Commit

Permalink
add grpc smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
pkanal committed Sep 21, 2022
1 parent efc7e08 commit ccd96a7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions smoke-tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@ services:
<<: *env_base
HONEYCOMB_API_ENDPOINT: http://collector:4318/v1/traces
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
ports:
- "127.0.0.1:5001:5001"

app-sdk-grpc:
<<: *app_base
environment:
<<: *env_base
OTEL_EXPORTER_OTLP_PROTOCOL: grpc
ports:
- "127.0.0.1:5001:5001"
33 changes: 33 additions & 0 deletions smoke-tests/smoke-sdk-grpc.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bats

load test_helpers/utilities

CONTAINER_NAME="app-sdk-grpc"
OTEL_SERVICE_NAME="aspnetcore-example"

setup_file() {
echo "# 🚧" >&3
docker-compose up --detach collector ${CONTAINER_NAME}
wait_for_ready_app ${CONTAINER_NAME}
curl --silent "http://localhost:5001/weatherforecast"
wait_for_traces
}

teardown_file() {
cp collector/data.json collector/data-results/data-${CONTAINER_NAME}.json
docker-compose stop ${CONTAINER_NAME}
docker-compose restart collector
wait_for_flush
}

# TESTS

@test "Manual instrumentation produces span with name of span" {
result=$(span_names_for ${OTEL_SERVICE_NAME})
assert_equal "$result" '"sleep"'
}

@test "Manual instrumentation adds custom attribute" {
result=$(span_attributes_for ${OTEL_SERVICE_NAME} | jq "select(.key == \"delay_ms\").value.intValue")
assert_equal "$result" '"100"'
}

0 comments on commit ccd96a7

Please sign in to comment.