Getting started
End-to-end tests
Run sample apps with the packed SDK against the whole stack in Docker.
bun run test:e2eBrowser tests need Chromium: run bunx playwright install chromium in tools/e2e. bun run test and bun run test:coverage skip tools/e2e.
What a run does
- Builds
packages/sdkand packs it intotools/e2e/.artifacts/openperf-sdk.tgz, the same package npm users install. - Builds the production images of
api,api-ingest,worker-errorsandworker-jobsand starts them with their stores.apiandapi-ingestmigrate on start. - Signs in through the email code flow, creates an organization, a project for each of the browser, Node.js and Bun apps, and an API token.
- Starts the sample apps in
tools/e2e/sample-apps, each with the DSN of its project. Each installs the tarball, not the workspace package. - Calls the apps, then polls the REST API until the spans, logs and errors show up.
- Saves the service logs to
tools/e2e/.artifacts/services.logand removes the stack.
The stack is the openperf-e2e compose project in tools/e2e/compose.yaml, on ports 14000–14300. It runs beside the dev stores; run one e2e stack per machine.
Options
| Variable | Effect |
|---|---|
E2E_NODE_VERSION | Node.js image for the sample apps. Defaults to 24, the SDK minimum. |
E2E_BUN_VERSION | Bun image for bun-server. |
Add a scenario
- Add a route to a sample app. After the request the test calls the app's
POST /flush, which runs the SDKflush(), so it doesn't wait for the batch timer. - Send a
traceparentwith a fresh trace ID fromcreateTraceparent()and wait withwaitForTrace(traceId, …): the trace holds its spans, logs and errors and skips the read cache. - Put a fresh ID in every error and log message: ingest drops repeated payloads, and the browser SDK drops repeated errors.
CI
.github/workflows/e2e.yml runs on pull requests with the e2e label: when the label is added and on every push while it stays. Add it to changes that touch the SDK, the API, ingest or the workers. It also runs by hand from the Actions tab with a Node.js version and a test name filter. A failed run uploads the service logs.