Skip to content

Commit 84dc791

Browse files
committed
ci: add more logs to tests
1 parent 51ec095 commit 84dc791

File tree

7 files changed

+49
-11
lines changed

7 files changed

+49
-11
lines changed

.github/workflows/smoke.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup BATS
1616
uses: mig4/setup-bats@v1
1717
with:
18-
bats-version: 1.10.0
18+
bats-version: 1.12.0
1919
- name: Check out repository
2020
uses: actions/checkout@v4
2121
- name: Run smoke tests

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@ smoke-sdk-grpc: smoke-tests/collector/data.json
2424
@echo ""
2525
@echo "+++ Running gRPC smoke tests."
2626
@echo ""
27-
cd smoke-tests && bats ./smoke-sdk-grpc.bats --report-formatter junit --output ./
27+
cd smoke-tests && bats ./smoke-sdk-grpc.bats --report-formatter junit --output ./ --verbose-run
2828

2929
smoke-sdk-grpc-ts: smoke-tests/collector/data.json
3030
@echo ""
3131
@echo "+++ Running gRPC smoke tests for TypeScript."
3232
@echo ""
33-
cd smoke-tests && bats ./smoke-sdk-grpc-ts.bats --report-formatter junit --output ./
33+
cd smoke-tests && bats ./smoke-sdk-grpc-ts.bats --report-formatter junit --output ./ --verbose-run
3434

3535
smoke-sdk-http: smoke-tests/collector/data.json
3636
@echo ""
3737
@echo "+++ Running HTTP smoke tests."
3838
@echo ""
39-
cd smoke-tests && bats ./smoke-sdk-http.bats --report-formatter junit --output ./
39+
cd smoke-tests && bats ./smoke-sdk-http.bats --report-formatter junit --output ./ --verbose-run
4040

4141
smoke-sdk-http-ts: smoke-tests/collector/data.json
4242
@echo ""
4343
@echo "+++ Running HTTP smoke tests for TypeScript."
4444
@echo ""
45-
cd smoke-tests && bats ./smoke-sdk-http-ts.bats --report-formatter junit --output ./
45+
cd smoke-tests && bats ./smoke-sdk-http-ts.bats --report-formatter junit --output ./ --verbose-run
4646

4747
smoke-sdk: smoke-sdk-http smoke-sdk-http-ts
4848

4949
smoke: docker_compose_present
5050
@echo ""
5151
@echo "+++ Smoking all the tests."
5252
@echo ""
53-
cd smoke-tests && bats . --report-formatter junit --output ./
53+
cd smoke-tests && bats . --report-formatter junit --output ./ --verbose-run
5454

5555
unsmoke: docker_compose_present
5656
@echo ""

smoke-tests/smoke-sdk-grpc-ts.bats

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,39 @@ METER_NAME="hello-world-meter"
88
NODE_METER_NAME="node-monitor-meter"
99

1010
setup_file() {
11-
echo "# 🚧" >&3
11+
echo "# 🚧 Starting smoke-sdk-grpc-ts tests" >&3
12+
echo "# 📦 Building and starting containers: collector ${CONTAINER_NAME}" >&3
1213
docker compose up --build --detach collector ${CONTAINER_NAME}
1314
wait_for_ready_app ${CONTAINER_NAME}
15+
echo "# 🌐 Sending test request to http://localhost:3000" >&3
1416
curl --silent "http://localhost:3000"
1517
wait_for_traces
1618
# wait_for_metrics
1719
}
1820

1921
teardown_file() {
22+
echo "# 🧹 Cleaning up smoke-sdk-grpc-ts tests" >&3
23+
echo "# 💾 Saving collector data to data-${CONTAINER_NAME}.json" >&3
2024
cp collector/data.json collector/data-results/data-${CONTAINER_NAME}.json
25+
echo "# 🛑 Stopping ${CONTAINER_NAME} container" >&3
2126
docker compose stop ${CONTAINER_NAME}
27+
echo "# 🔄 Restarting collector" >&3
2228
docker compose restart collector
2329
wait_for_flush
2430
}
2531

2632
# TESTS
2733

2834
@test "Auto instrumentation produces 3 Express middleware spans" {
35+
echo "# ✅ Testing: Auto instrumentation produces 3 Express middleware spans" >&3
2936
result=$(span_names_for "@opentelemetry/instrumentation-express")
3037
assert_equal "$result" '"middleware - query"
3138
"middleware - expressInit"
3239
"request handler - /"'
3340
}
3441

3542
@test "Auto instrumentation produces an http request span" {
43+
echo "# ✅ Testing: Auto instrumentation produces an http request span" >&3
3644
result=$(span_names_for "@opentelemetry/instrumentation-http")
3745
assert_equal "$result" '"GET /"'
3846
}

smoke-tests/smoke-sdk-grpc.bats

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,39 @@ TRACER_NAME="hello-world-tracer"
77
METER_NAME="hello-world-meter"
88

99
setup_file() {
10-
echo "# 🚧" >&3
10+
echo "# 🚧 Starting smoke-sdk-grpc tests" >&3
11+
echo "# 📦 Building and starting containers: collector ${CONTAINER_NAME}" >&3
1112
docker compose up --build --detach collector ${CONTAINER_NAME}
1213
wait_for_ready_app ${CONTAINER_NAME}
14+
echo "# 🌐 Sending test request to http://localhost:3000" >&3
1315
curl --silent "http://localhost:3000"
1416
wait_for_traces
1517
# wait_for_metrics 5
1618
}
1719

1820
teardown_file() {
21+
echo "# 🧹 Cleaning up smoke-sdk-grpc tests" >&3
22+
echo "# 💾 Saving collector data to data-${CONTAINER_NAME}.json" >&3
1923
cp collector/data.json collector/data-results/data-${CONTAINER_NAME}.json
24+
echo "# 🛑 Stopping ${CONTAINER_NAME} container" >&3
2025
docker compose stop ${CONTAINER_NAME}
26+
echo "# 🔄 Restarting collector" >&3
2127
docker compose restart collector
2228
wait_for_flush
2329
}
2430

2531
# TESTS
2632

2733
@test "Auto instrumentation produces 3 Express middleware spans" {
34+
echo "# ✅ Testing: Auto instrumentation produces 3 Express middleware spans" >&3
2835
result=$(span_names_for "@opentelemetry/instrumentation-express")
2936
assert_equal "$result" '"middleware - query"
3037
"middleware - expressInit"
3138
"request handler - /"'
3239
}
3340

3441
@test "Auto instrumentation produces an http request span" {
42+
echo "# ✅ Testing: Auto instrumentation produces an http request span" >&3
3543
result=$(span_names_for "@opentelemetry/instrumentation-http")
3644
assert_equal "$result" '"GET /"'
3745
}

smoke-tests/smoke-sdk-http-ts.bats

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,51 @@ METER_NAME="hello-world-meter"
88
NODE_METER_NAME="node-monitor-meter"
99

1010
setup_file() {
11-
echo "# 🚧" >&3
11+
echo "# 🚧 Starting smoke-sdk-http-ts tests" >&3
12+
echo "# 📦 Building and starting containers: collector ${CONTAINER_NAME}" >&3
1213
docker compose up --build --detach collector ${CONTAINER_NAME}
1314
wait_for_ready_app ${CONTAINER_NAME}
15+
echo "# 🌐 Sending test request to http://localhost:3000" >&3
1416
curl --silent "http://localhost:3000"
1517
wait_for_traces
1618
# wait_for_metrics 15
1719
}
1820

1921
teardown_file() {
22+
echo "# 🧹 Cleaning up smoke-sdk-http-ts tests" >&3
23+
echo "# 💾 Saving collector data to data-${CONTAINER_NAME}.json" >&3
2024
cp collector/data.json collector/data-results/data-${CONTAINER_NAME}.json
25+
echo "# 🛑 Stopping ${CONTAINER_NAME} container" >&3
2126
docker compose stop ${CONTAINER_NAME}
27+
echo "# 🔄 Restarting collector" >&3
2228
docker compose restart collector
2329
wait_for_flush
2430
}
2531

2632
# TESTS
2733

2834
@test "Auto instrumentation produces 3 Express middleware spans" {
35+
echo "# ✅ Testing: Auto instrumentation produces 3 Express middleware spans" >&3
2936
result=$(span_names_for "@opentelemetry/instrumentation-express")
3037
assert_equal "$result" '"middleware - query"
3138
"middleware - expressInit"
3239
"request handler - /"'
3340
}
3441

3542
@test "Auto instrumentation produces an http request span" {
43+
echo "# ✅ Testing: Auto instrumentation produces an http request span" >&3
3644
result=$(span_names_for "@opentelemetry/instrumentation-http")
3745
assert_equal "$result" '"GET /"'
3846
}
3947

4048
@test "Manual instrumentation produces span with name of span" {
49+
echo "# ✅ Testing: Manual instrumentation produces span with name of span" >&3
4150
result=$(span_names_for ${TRACER_NAME})
4251
assert_equal "$result" '"sleep"'
4352
}
4453

4554
@test "Manual instrumentation adds custom attribute" {
55+
echo "# ✅ Testing: Manual instrumentation adds custom attribute" >&3
4656
result=$(span_attributes_for ${TRACER_NAME} | jq "select(.key == \"delay_ms\").value.intValue")
4757
assert_equal "$result" '"100"'
4858
}

smoke-tests/smoke-sdk-http.bats

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,51 @@ TRACER_NAME="hello-world-tracer"
77
METER_NAME="hello-world-meter"
88

99
setup_file() {
10-
echo "# 🚧" >&3
10+
echo "# 🚧 Starting smoke-sdk-http tests" >&3
11+
echo "# 📦 Building and starting containers: collector ${CONTAINER_NAME}" >&3
1112
docker compose up --build --detach collector ${CONTAINER_NAME}
1213
wait_for_ready_app ${CONTAINER_NAME}
14+
echo "# 🌐 Sending test request to http://localhost:3000" >&3
1315
curl --silent "http://localhost:3000"
1416
wait_for_traces
1517
# wait_for_metrics 15
1618
}
1719

1820
teardown_file() {
21+
echo "# 🧹 Cleaning up smoke-sdk-http tests" >&3
22+
echo "# 💾 Saving collector data to data-${CONTAINER_NAME}.json" >&3
1923
cp collector/data.json collector/data-results/data-${CONTAINER_NAME}.json
24+
echo "# 🛑 Stopping ${CONTAINER_NAME} container" >&3
2025
docker compose stop ${CONTAINER_NAME}
26+
echo "# 🔄 Restarting collector" >&3
2127
docker compose restart collector
2228
wait_for_flush
2329
}
2430

2531
# TESTS
2632

2733
@test "Auto instrumentation produces 3 Express middleware spans" {
34+
echo "# ✅ Testing: Auto instrumentation produces 3 Express middleware spans" >&3
2835
result=$(span_names_for "@opentelemetry/instrumentation-express")
2936
assert_equal "$result" '"middleware - query"
3037
"middleware - expressInit"
3138
"request handler - /"'
3239
}
3340

3441
@test "Auto instrumentation produces an http request span" {
42+
echo "# ✅ Testing: Auto instrumentation produces an http request span" >&3
3543
result=$(span_names_for "@opentelemetry/instrumentation-http")
3644
assert_equal "$result" '"GET /"'
3745
}
3846

3947
@test "Manual instrumentation produces span with name of span" {
48+
echo "# ✅ Testing: Manual instrumentation produces span with name of span" >&3
4049
result=$(span_names_for ${TRACER_NAME})
4150
assert_equal "$result" '"sleep"'
4251
}
4352

4453
@test "Manual instrumentation adds custom attribute" {
54+
echo "# ✅ Testing: Manual instrumentation adds custom attribute" >&3
4555
result=$(span_attributes_for ${TRACER_NAME} | jq "select(.key == \"delay_ms\").value.intValue")
4656
assert_equal "$result" '"100"'
4757
}

smoke-tests/test_helpers/utilities.bash

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ metrics_received() {
1818

1919
# test span name
2020
span_names_for() {
21+
echo "# 🔍 Getting span names for library: $1" >&3
2122
spans_from_library_named $1 | jq '.name'
2223
}
2324

2425
# test span attributes
2526
span_attributes_for() {
2627
# $1 - library name
27-
28+
echo "# 🔍 Getting span attributes for library: $1" >&3
2829
spans_from_library_named $1 | \
2930
jq ".attributes[]"
3031
}
3132

3233
# test metric name
3334
metric_names_for() {
35+
echo "# 🔍 Getting metric names for library: $1" >&3
3436
metrics_from_library_named $1 | jq '.name'
3537
}
3638

0 commit comments

Comments
 (0)