Rewrite script/test to the canonical pattern (30s timeout, -race -cover, conditional verbose rerun) #67
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
script/test:20is a single line that violates the test policy three ways:the gpg tests generate real RSA-2048 keys via a
gpgsubprocess, and on aslow or entropy-starved machine (CI, a container, a loaded laptop) that
keygen races the 10s budget for the entire
./...run. The suite takes~3s locally, so the failure is invisible until it is not.
pattern so CI and
docker buildoutput stays readable on success andfully diagnostic on failure.
-race, no-cover. The repo runs concurrent scanners andcheckers with progress goroutines and a test-suite mutex around a
process-global logger. That is exactly the code where the race detector
earns its keep, and it has never been run.
Definition of done
script/test'smain()matches the canonical pattern:The
exit 1is present, so the target fails even if a flaky test happensto pass on the verbose rerun.
make testpasses with-raceenabled. Any data race the detector findsis a real bug and is fixed in this PR, not silenced.
make testcompletes in under 20 seconds wall-clock, per policy.make checkpasses.TODO.mdupdated in the same commit.Implementation requirements
unbounded gpg subprocess is tracked in #62; do not close that by widening
the budget here, and do not duplicate its fix here.
-racesurfaces a race in the CLI's process-global logger or in thescanner/checker progress goroutines, fix the race. Do not remove
-race,do not add
t.Skip, and do not serialize the tests further to hide it.-raceroughly doubles runtime. If that pushes the suite past 20s, theanswer is to make the slow tests cheaper (the gpg tests each generate a
fresh RSA-2048 key — a shared per-package key fixture would cut most of
it), not to drop the flag.
ensure_pbbehavior in this PR; the fact that it canmutate tracked files during
make checkis tracked separately.(closes #67).