Skip to Content
OpenPerf

Getting started

End-to-end tests

Run sample apps with the packed SDK against the whole stack in Docker.

bun run test:e2e

Browser 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

  1. Builds packages/sdk and packs it into tools/e2e/.artifacts/openperf-sdk.tgz, the same package npm users install.
  2. Builds the production images of api, api-ingest, worker-errors and worker-jobs and starts them with their stores. api and api-ingest migrate on start.
  3. 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.
  4. Starts the sample apps in tools/e2e/sample-apps, each with the DSN of its project. Each installs the tarball, not the workspace package.
  5. Calls the apps, then polls the REST API until the spans, logs and errors show up.
  6. Saves the service logs to tools/e2e/.artifacts/services.log and 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

VariableEffect
E2E_NODE_VERSIONNode.js image for the sample apps. Defaults to 24, the SDK minimum.
E2E_BUN_VERSIONBun 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 SDK flush(), so it doesn't wait for the batch timer.
  • Send a traceparent with a fresh trace ID from createTraceparent() and wait with waitForTrace(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.

On this page