Replayable API Smoke Tests in GitHub Actions
Описание и применение
Тесты API в GitHub Actions становятся воспроизводимыми и информативными благодаря явному идентификатору выполнения, ограниченному ожиданию и артефактам доказательств.
Задача
API smoke tests often pass without revealing which environment, data, or timing caused the success, making failures hard to reproduce and investigate.
Результат
Smoke tests become reproducible and informative; failures include run ID, environment, and evidence artifacts, enabling quick triage and retry decisions.
Рабочий процесс
- Define run contract variables (API_BASE_URL, SMOKE_RUN_ID, POLL_DEADLINE_SECONDS) via env or config.
- Create unique test data using SMOKE_RUN_ID and clean up or tag for janitor.
- Set up GitHub Actions workflow to run on push and workflow_dispatch with steps: checkout, setup-node, install deps, run smoke test with --run-id, always upload artifacts.
- Implement bounded polling for async email checks with deadline and distinguish missing vs rejected messages.
- Generate machine‑readable receipt JSON per run and upload as artifact.
- Review checklist: dispatchable, unique fixtures, bounded wait, sanitized evidence, distinct error types, environment identification, documented dependencies.
Доказательства
Give each run an explicit input, a bounded wait, and an evidence bundle. That turns GitHub Actions from a button that says “probably okay” into a developer tool you can inspect and re-run.
The test should create unique data with SMOKE_RUN_ID, then clean it up when the API allows that.
- Дата записи: 2026-09-17T00:00:28.090Z