Padmanav's picture
test(load): add Locust load test suite for /analyze and /analyze/async endpoints
4466add
|
Raw
History Blame Contribute Delete
718 Bytes
# Load Testing
Uses [Locust](https://locust.io) to simulate burst traffic against the API.
## Run locally
```bash
pip install locust
locust -f tests/load/locustfile.py \
--host=http://localhost:8000 \
--users=20 \
--spawn-rate=2 \
--run-time=60s \
--headless
```
## Environment variables
| Variable | Default | Description |
|---|---|---|
| `API_KEY` | `test-key` | API key sent in `X-API-Key` header |
| `LOAD_TEST_REPO` | `https://github.com/psf/requests` | Repo submitted for analysis |
## Expected behaviour under load
- `/analyze/async` should handle 20 req/min per key before returning 429
- `/api/v1/health` p99 should stay under 50ms
- Worker queue depth should stabilise, not grow unboundedly