Skip to content

k6 load testing composite and load-test reusable workflow (#74) - #168

Open
ms280690 wants to merge 1 commit into
mainfrom
issue-74-k6
Open

ms280690 wants to merge 1 commit into
mainfrom
issue-74-k6

Conversation

@ms280690

Copy link
Copy Markdown
Collaborator

Closes #74. From main, no stack.

What

  • .github/actions/k6: k6 2.3.0 tarball verified against k6-v2.3.0-checksums.txt, installed to $RUNNER_TEMP. Inputs script, target-url (exported as BASE_URL), vus, duration, extra-args, summary-file. k6 run --summary-export; exit 99 (thresholds crossed) is carried to a final failing step after the summary is rendered, any other exit fails immediately. summary.py (stdlib) renders requests, requests per second, p95 and max latency, error rate, checks and a pass/fail row per threshold into the job summary and sets outputs thresholds-failed, thresholds-total, p95-ms, error-rate, requests. Usage reporting off (K6_NO_USAGE_REPORT).
  • load-test.yml: inputs from the issue plus extra-args and actions-ref; k6-summary artefact always uploaded; outputs p95-ms, error-rate.
  • docs/examples/k6/stac-search.js: GET /collections and POST /search with a bbox and limit, thresholds p(95)<800, rate<0.01, checks rate>0.99.
  • README rows and "Load Test (k6)" section; k6 row in docs/approved-actions.md.
  • CI k6 job: summary.py fixtures, then the composite against python3 -m http.server on the runner (no egress), once passing (asserts zero crossed thresholds and requests made) and once with --env P95_MS=0.001 expecting failure with exactly one crossed threshold.

Tests

tests/k6/run.sh with summaries recorded from real k6 2.3.0 runs (pass and threshold crossed): outputs, summary rows, annotation, exit codes 0/1/2. In the --summary-export format a threshold entry of true means crossed; the script reads it that way.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF

Run a k6 script from the consuming repo against a target URL exported as
BASE_URL with a checksum-verified k6 binary. The script's thresholds are
the gate: k6 exits 99 when one is crossed and the step fails after the
summary is rendered. summary.py turns the --summary-export JSON into a job
summary (requests, rate, p95 and max latency, error rate, checks, every
threshold) and step outputs. load-test.yml wraps the composite and keeps
the summary JSON as an artefact. docs/examples/k6/stac-search.js is a STAC
collections and search script with thresholds.

CI checks summary.py against recorded summaries, then runs the composite
against a local static server once passing and once with an impossible
p95 threshold that must fail.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
@ms280690 ms280690 self-assigned this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: tests — load and stress testing with k6 (pre-release)

1 participant