Test examples
Each file below goes in ci/reoclo/tests/ in your repository. Replace the pool value with the slug of your own test pool. For every key and limit, see Test files. For the full walkthrough, see Run tests on test servers.
Steps run with sh -e in the job’s image, so the image needs sh. The repository is at /workspace, which is also the working directory. A job with docker: true runs from the checkout’s real path on the machine instead, so bind mounts work; see Docker in a job.
Node.js unit tests
Section titled “Node.js unit tests”version: 1pool: cion: push: branches: [main, "release/*"]jobs: unit: image: node:22 timeout_minutes: 20 steps: - name: Install dependencies run: npm ci - name: Run unit tests run: npm testPushes to main and any release/ branch start a run. The job stops at the first failing step.
Python
Section titled “Python”version: 1pool: cion: push: branches: [main]env: PYTHONUNBUFFERED: 1jobs: pytest: image: python:3.13 timeout_minutes: 30 steps: - name: Install dependencies run: pip install -r requirements.txt - name: Run pytest run: pytest -qValues under env are plain text, so the number is passed as the string 1.
version: 1pool: cion: push: branches: [main]jobs: go-test: image: golang:1.24 timeout_minutes: 15 steps: - name: Vet run: go vet ./... - name: Test run: go test -race ./...Job IDs use lowercase letters, digits, dashes and underscores, so go-test is valid.
Smoke test, then load test
Section titled “Smoke test, then load test”version: 1pool: loadteston: push: branches: [main] manual: truejobs: smoke: image: grafana/k6:latest timeout_minutes: 10 env: BASE_URL: https://staging.example.com steps: - name: Smoke test run: k6 run --vus 1 --duration 30s load/smoke.js load: needs: [smoke] image: grafana/k6:latest timeout_minutes: 90 env: BASE_URL: https://staging.example.com steps: - name: Load test run: k6 run --vus 200 --duration 20m load/checkout.jsload waits for smoke and starts only if it passes. If smoke fails, load is skipped and no second machine is created. Give the loadtest pool a large machine type, since the load generator runs on it.
Load test that takes a room link
Section titled “Load test that takes a room link”version: 1pool: loadteston: manual: inputs: room_link: description: Link to the room to load required: true users: description: Number of simulated users default: 200 duration: description: How long to hold the load default: 10mjobs: load: image: grafana/k6:latest timeout_minutes: 90 steps: - name: Load the room run: k6 run --vus "$INPUT_USERS" --duration "$INPUT_DURATION" -e ROOM_LINK="$INPUT_ROOM_LINK" load/room.jsThe room changes every run, so the link is an input instead of a value in the file. Each input reaches the job as INPUT_ and its name in upper case, so room_link is INPUT_ROOM_LINK. room_link is required and has no default, so a run cannot start without one. users and duration fall back to their defaults.
Start it from the dashboard, where the Run dialog shows a field for each input, or from the command line:
reoclo tests run room-load --input room_link=https://rooms.example.com/r/4821 --input users=500 --waitBecause a run started by a push or a pull request has nobody to type a link, a file with a required input and no default cannot also run on push or pull requests. See Manual run inputs.
A job that uses a pool secret
Section titled “A job that uses a pool secret”version: 1pool: cion: push: branches: [main]jobs: integration: image: node:22 timeout_minutes: 30 steps: - name: Install private packages run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc npm ci - name: Run integration tests run: npm run test:integrationAdd NPM_TOKEN as a variable on the pool and tick Secret. The job receives it as an environment variable, and the file never contains the value. If a command prints it, the log shows ***.
Run only the specs a pull request changes
Section titled “Run only the specs a pull request changes”version: 1pool: cion: pull_request: branches: [main] manual: truejobs: unit: image: node:22 timeout_minutes: 20 steps: - name: Install dependencies run: npm ci - name: Run the specs this pull request changes run: | if [ -z "$REOCLO_BASE_SHA" ]; then npx vitest run exit 0 fi specs=$(git diff --name-only --diff-filter=d "$REOCLO_BASE_SHA"...HEAD -- '*.spec.ts') if [ -z "$specs" ]; then echo "No spec file changed in this pull request." exit 0 fi npx vitest run $specsA pull request run gets REOCLO_BASE_SHA, the commit the target branch pointed at when the run started. The three dot form compares the pull request with the common ancestor, so commits that landed on main after the branch was cut do not count as changes. A manual run has no base, so the step runs every spec. The job has no git credentials, so use REOCLO_BASE_SHA rather than git fetch origin main, which fails. See Variables a job receives.
A pnpm cache
Section titled “A pnpm cache”version: 1pool: cion: push: branches: [main]jobs: unit: image: node:22 timeout_minutes: 20 cache: key: pnpm key_files: [pnpm-lock.yaml] paths: [.pnpm-store] steps: - name: Install dependencies run: | corepack enable pnpm install --frozen-lockfile --store-dir .pnpm-store - name: Run unit tests run: pnpm testThe first run installs everything and saves .pnpm-store. A later run with the same pnpm-lock.yaml restores that exact cache before the first step, so the install only links packages. After a lockfile change, the job starts from the most recent cache and saves a new one when the steps pass. --store-dir .pnpm-store puts the package store inside the checkout, which is where a cache path has to be, so add .pnpm-store to .gitignore. The pool needs a storage bucket. See Cache for the rules.
A Playwright report as an artifact
Section titled “A Playwright report as an artifact”version: 1pool: cion: pull_request: branches: [main] manual: truejobs: e2e: image: mcr.microsoft.com/playwright:v1.49.0-noble timeout_minutes: 30 artifacts: paths: [playwright-report, test-results] when: always steps: - name: Install dependencies run: npm ci - name: Run the browser tests run: npx playwright testThe job uploads the HTML report and the traces whether the tests pass or fail, because when is always. Open the run page after the run finishes and choose Download next to the job. Unpack the .tar.gz and open playwright-report/index.html. Use when: failure to keep reports only for failed runs. The pool needs a storage bucket. See Artifacts for the rules.
Integration tests with Testcontainers
Section titled “Integration tests with Testcontainers”version: 1pool: cion: push: branches: [main]jobs: integration: image: node:22 docker: true timeout_minutes: 30 steps: - name: Install dependencies run: npm ci - name: Run integration tests run: npm run test:integrationThe tests start their own MongoDB and Redis containers with Testcontainers. docker: true mounts the machine’s Docker socket into the job and sets DOCKER_HOST, TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE and TESTCONTAINERS_HOST_OVERRIDE, so Testcontainers finds the daemon, cleans up after the run and reaches the services it started on 127.0.0.1. The node:22 image needs no Docker client, because Testcontainers talks to the socket directly.
End-to-end tests with docker compose and submodules
Section titled “End-to-end tests with docker compose and submodules”version: 1pool: cicheckout: submodules: trueon: push: branches: [main] manual: truejobs: e2e: image: docker:cli docker: true timeout_minutes: 45 steps: - name: Start the stack run: docker compose -f compose.e2e.yml up -d --build --wait - name: Check the health endpoint run: wget -qO- http://127.0.0.1:8080/health - name: Stop the stack run: docker compose -f compose.e2e.yml down --volumescheckout.submodules fetches the repository’s submodules, which compose.e2e.yml builds from. Relative bind mounts in the compose file, such as ./init.sql:/docker-entrypoint-initdb.d/init.sql, resolve from the checkout and reach the service. The docker:cli image has docker compose. The job shares the machine’s network, so a port the stack publishes is reached on 127.0.0.1. Use 127.0.0.1 rather than localhost: Docker publishes the port on IPv4 only, and localhost resolves to the IPv6 address first. If a step fails, the later steps are skipped, including Stop the stack. That is fine here, because the machine is deleted when the job ends and takes the containers with it.