Load tests
SHADE keeps a few small load tests for k6, in shade/scripts/load/. They run from k6's official
Docker image, so nothing is installed, and never in CI. Use them to see whether a change made a hot path faster or
slower, on the same machine before and after: one developer machine says how paths compare, not what a server will do.
| Script | What it measures |
|---|---|
content.js | The content API as a site build or a server-rendered frontend reads it: a page of a collection's published entries, one entry by its slug, and /site |
site-page.js | One page by its slug from a module's read model (the website module's /api/v1/content/website/pages/by-slug), and the built page with SITE_URL |
sign-in.js | The team's sign-in, POST /api/auth/login |
Running one
Start a test instance first: the site tests' server (e2e/site-server.ts) gives one with content, the modules you
name in SHADE_E2E_MODULES and a read token in e2e/.data/site-token. Then, from shade/:
docker run --rm -i -v "$PWD/scripts/load:/scripts" \
-e BASE_URL=http://host.docker.internal:4341 -e TOKEN="$(cat e2e/.data/site-token)" \
-e COLLECTION=website-posts -e SLUGS=bericht-1,bericht-2 -e VUS=20 -e DURATION=30s \
grafana/k6:1.3.0 run --quiet /scripts/content.js
- Inside Docker the host is
host.docker.internal. The API's port follows your test slot (4341, plus 100 per slot). VUS(virtual users, 20 by default) andDURATION(30s) set the load. The summary gives requests per second (http_reqs) and p50, p95 and p99 per named request.- In Git Bash on Windows, put
MSYS_NO_PATHCONV=1beforedocker. - The image's tag is pinned; change it on purpose.
Sign-in is rate limited per address and per account, and its password check is slow on purpose, so a sign-in test
needs several accounts and the instance's SHADE_PROXY_SECRET: the script's README (shade/scripts/load/README.md)
says how. Never run these scripts against a client's instance.