Quality Gate
The quality gate turns a run into a pass/fail verdict by comparing it to a baseline. It is what powers the GitHub PR check and the verdict shown on each run page.
1. What it checks
For each ingested run, QualityGateService evaluates:
-
New failures — by default, any failing test fails the gate.
-
Coverage drop — line coverage must not fall more than the allowed margin below the baseline.
-
Minimum coverage — an optional absolute floor on line coverage.
2. The baseline
The baseline is the most recent run on the configured base branch (default main) for the
same project. A pull-request build is therefore measured against the current state of the
branch it targets — so the gate answers "does this change make things worse?".
3. Per-project overrides
The thresholds below are global defaults. Each project can override any of them from its
Settings page (/projects/{id}/settings, requires login) — e.g. a stricter minimum
coverage for one service. A blank field inherits the global default, so you only set what
differs. The effective config (overrides merged over the globals) is what the gate,
regression report, and GitHub status
all use.
4. Configuration
All global defaults live under unitrack.quality-gate (see Configuration):
| Property | Default | Meaning |
|---|---|---|
|
|
Branch whose latest run is the baseline. |
|
unset |
Absolute minimum line-coverage percentage, if set. |
|
|
Largest allowed drop vs the baseline, in percentage points. |
|
|
Fail the gate when the run has any test failures. |
5. Result
The evaluation yields a verdict plus the coverage delta against the baseline. Both are shown
on the run page and, when GitHub is configured, posted as a commit status with the context
unitrack/quality-gate.
6. Gating any CI (not just GitHub)
Beyond the GitHub commit status, the verdict is available as a machine-readable result so
any pipeline can fail a build on it. GET /api/v1/gate?project=<name>&commit=<sha> returns
the latest matching run’s verdict (see REST API), and
scripts/unitrack-gate.sh wraps it into an exit code:
scripts/unitrack-gate.sh --project myapp --commit "$CI_COMMIT_SHA" # exit 1 if the gate failed
This works on GitLab CI, Jenkins, Buildkite, or a local pre-push hook — see CLI & CI Integration.