# CI performance gate — the test the GitHub Action runs on every PR.
# Thresholds are the gate: if p95/p99 latency, error rate, or check rate regress
# past these limits, loadr exits non-zero and the CI job goes red.
name: perf-smoke
description: fast PR performance gate

defaults:
  http:
    base_url: "${secrets.target_url}"   # provided by the CI env (TARGET_URL)

secrets:
  target_url: { env: TARGET_URL }

scenarios:
  smoke:
    executor: constant-vus
    vus: 20
    duration: 30s
    flow:
      - request: { name: home, url: /, checks: [ { type: status, equals: 200 } ] }
      - request: { name: health, url: /api/health, checks: [ { type: status, equals: 200 } ] }

thresholds:
  http_req_failed: [ "rate<0.01" ]
  http_req_duration: [ "p(95)<300", "p(99)<800" ]
  checks: [ "rate>0.99" ]
