test: enforce a slow-test budget on CI - #179
Merged
Merged
Conversation
Up to standards ✅🟢 Issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 5 of the CI/test-speed plan: the guardrail. Two layers, calibrated against measured numbers rather than a round guess.
Why
A resolver test drifted to 50 seconds — a debug-build loop asserting a bound that holds at any size. It was the slowest test in the workspace by roughly 500x, and it was found only because I went looking for where CI time went. Nothing in the repo objected, and nothing would have objected to the next one.
Layer 1 —
slow-timeoutwarns.config/nextest.tomlgainsslow-timeout = { period = "10s", terminate-after = 12 }. nextest printsSLOW [> 10.000s]and counts it in the summary.terminate-afterlands at 120s and is set to catch a hang, not a slow test — deliberately generous, because a budget that fails the build intermittently is a budget people delete.One override, with its reason:
migration_0024_restores_registrations_lost_before_the_fixapplies a migration to a server that predates it, so by definition it cannot clone the shared template and must boot its own Postgres.Verified firing: a deliberately-slow probe produced
SLOW [> 10.000s]and1 passed (1 slow). Reverted.Layer 2 — the budget that actually fails
A warning in a log nobody reads is not a budget.
scripts/slow-test-check.shreads the JUnit CI already writes and fails the job on anything over 10s.Reading recorded times rather than re-running means the check measures what happened and cannot itself be flaky.
Verified in both directions against real CI output: passes at 10s over 575 tests, and at a 3s budget correctly names the eight tests that exceed it.
Why 10s, and why CI-only
Taken from the JUnit artifact of the last
mainrun, not from intuition:migration_0024is 3.83s on a Linux runner and 17.6s on this machine — container startup behind Docker Desktop goes through a VM.Enforcing that threshold locally would fail honest work on the wrong machine, so locally
slow-timeoutwarns and that is the right strength.The allowlist is empty on purpose
Every test that starts its own container still lands under 10s on a Linux runner, so nothing needs an exemption today. The list exists so the first real one is argued for in review rather than absorbed by raising the number — and the failure message says so: "Raising the budget is not the fix."
Verification
just checkgreen: 842 tests, all gates,cargo audit. The budget script was run against the real CI JUnit at both a passing and a failing threshold.ci.ymlparses.