Skip to content

Commit 6087506

Browse files
committed
Add an integration test
1 parent 82a8c3a commit 6087506

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"event_id":"66578634d48d433db0ad52882d1efe5b","sent_at":"2023-05-17T14:54:31.057Z","sdk":{"name":"sentry.javascript.node","version":"7.46.0"},"trace":{"environment":"production","transaction":"fib: sourcemaps here","public_key":"05ab86aebbe14a24bcab62caa839cf27","trace_id":"33321bfbd5304bcc9663d1b53b08f84e","sample_rate":"1"}}
2+
{"type":"transaction"}
3+
{"contexts":{"trace":{"op":"test","span_id":"b38f2b24537c3858","trace_id":"33321bfbd5304bcc9663d1b53b08f84e"},"runtime":{"name":"node","version":"v16.16.0"},"app":{"app_start_time":"2023-05-17T14:54:27.678Z","app_memory":57966592},"os":{"kernel_version":"22.3.0","name":"macOS","version":"13.2","build":"22D49"},"device":{"boot_time":"2023-05-12T15:08:41.047Z","arch":"arm64","memory_size":34359738368,"free_memory":6861651968,"processor_count":10,"cpu_description":"Apple M1 Pro","processor_frequency":24},"culture":{"locale":"en-US","timezone":"America/New_York"}},"spans":[],"start_timestamp":1684335267.744,"tags":{},"timestamp":1684335271.033,"transaction":"fib: sourcemaps here","type":"transaction","transaction_info":{"source":"custom"},"platform":"node","server_name":"TK6G745PW1.local","event_id":"66578634d48d433db0ad52882d1efe5b","environment":"production","sdk":{"integrations":["InboundFilters","FunctionToString","Console","Http","OnUncaughtException","OnUnhandledRejection","ContextLines","LocalVariables","Context","Modules","RequestData","LinkedErrors","ProfilingIntegration"],"name":"sentry.javascript.node","version":"7.46.0","packages":[{"name":"npm:@sentry/node","version":"7.46.0"}]},"debug_meta":{"images":[]},"modules":{}}

_integration-test/run.sh

+12
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ timeout 60 bash -c 'until $(sentry_api_request "$PROFILE_PATH" -Isf -X GET -o /d
149149
echo " got it!"
150150
echo "${_endgroup}"
151151

152+
echo "${_group}Test we can extract spans from an event..."
153+
echo "Sending a test span..."
154+
SPAN_FIXTURE_PATH="$(git rev-parse --show-toplevel)/_integration-test/fixtures/envelope-with-transaction"
155+
curl -sf --data-binary @$PROFILE_FIXTURE_PATH -H 'Content-Type: application/x-sentry-envelope' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$SENTRY_KEY, sentry_client=test-bash/0.1" "$SENTRY_TEST_HOST/api/$PROJECT_ID/envelope/" -o /dev/null
156+
157+
printf "Getting a span back"
158+
TRACE_ID="$(jq -r -n --slurpfile span $SPAN_FIXTURE_PATH '$span[2].contexts.trace.trace_id')"
159+
SPAN_PATH="api/0/organizations/sentry/events/?dataset=spansIndexed&field=id&project=1&query=trace%3A$TRACE_ID&statsPeriod=1h"
160+
timeout 60 bash -c "until (($(sentry_api_request "$SPAN_PATH" -Isf -X GET | jq 'data.length') -gt 0)); do printf '.'; sleep 0.5; done"
161+
echo " got it!"
162+
echo "${_endgroup}"
163+
152164
# Table formatting based on https://stackoverflow.com/a/39144364
153165
COMPOSE_PS_OUTPUT=$(docker compose ps --format json | jq -r \
154166
'.[] |

0 commit comments

Comments
 (0)