Make the test gate unfakeable and stop test-integration lying (closes #93)
All checks were successful
check / check (push) Successful in 3m42s
All checks were successful
check / check (push) Successful in 3m42s
Closes #69. script/test ran `go test` without -count=1, so Go's test cache satisfied the gate without running anything: a repeat `make test` printed all 14 ok lines in 0.42 seconds, every one marked (cached). Those lines count as ok lines, so the evidence signal this repo relies on was forgeable. It sits below the Docker layer cache - CHECK_EPOCH forces `RUN make test` to re-execute, but a GOCACHE baked into an earlier image layer survives into the re-executed step, so the step can run and still do no work. -count=1 is applied unconditionally rather than only in the container, because the pre-commit hook runs the same script and a gate honest only in CI is dishonest where it is leaned on most. It costs about 11 seconds on every repeat run, which is what it costs for a repeat run to mean anything. test-coverage had the same omission and is fixed too; a coverage profile assembled from cached results describes a run that did not happen. Both invocations in script/test now share one run_tests function so the quiet run and the verbose rerun cannot drift apart in flags. make test-integration passed -tags=integration while no file in the repo carries any build tag, so it was an exact duplicate of make test. Removed rather than given a tag scheme: the whole suite is 12s on the host, so gating saves seconds in exchange for a mechanism whose failure mode is "some tests silently stopped running" - a poor trade in a repo that has found several ways for a gate to report an unearned green. -timeout goes 30s to 120s. This DIVERGES from REPO_POLICIES.md:192, which mandates 30s; the divergence is deliberate, recorded in script/test's comment, and proposed upstream as #101. Measured worst case is 10.2s and each fresh measurement has come in above the last, leaving 30s at 2.9x - too thin for a loaded runner. A -timeout is a hang backstop, not a performance budget. Note for the record: cold-cache compilation is NOT charged against -timeout. The flag reaches the test binary as -test.timeout and its clock starts inside testing.M.Run, after compilation. Verified twice independently - a run with an empty GOCACHE spent ~46s compiling and then reported per-package durations within noise of warm. A shell `timeout 30 go test ./...` does include compilation, but that is a different mechanism.
This commit was merged in pull request #98.
This commit is contained in:
19
README.md
19
README.md
@@ -600,7 +600,24 @@ them. We provide:
|
||||
`script/bootstrap`, then `script/install-precommit`
|
||||
* `script/projectname` — print the project name (used for the Docker
|
||||
image tag)
|
||||
* `script/test` — run the test suite (verbose rerun on failure)
|
||||
* `script/test` — run the test suite (verbose rerun on failure). This
|
||||
runs *everything*: there is no separate integration target and no
|
||||
build-tagged subset held back, so the full round-trip tests in
|
||||
`internal/vaultik/integration_test.go` run on every invocation. It
|
||||
passes `-count=1`, which disables Go's test result cache. That is
|
||||
deliberate and it is not free: on this repo's suite it costs about 11
|
||||
seconds on every repeat run (measured, back to back: 0.4s cached
|
||||
versus 11.6s with `-count=1`). That is the price of the run meaning
|
||||
anything, because without it an unchanged package prints
|
||||
`ok <pkg> (cached)`, which is indistinguishable from a package that
|
||||
really ran, so the whole suite can report a full set of `ok` lines in
|
||||
under half a second having executed nothing. The `-timeout` is a hang
|
||||
backstop rather than a performance budget — it applies per test binary
|
||||
to test execution only, not to compilation — and is set well above the
|
||||
slowest package's measured runtime. Its 120s value deliberately
|
||||
diverges from the 30s `REPO_POLICIES.md` mandates; the reasoning is in
|
||||
the comment in the script, and issue #101 proposes amending the policy
|
||||
text.
|
||||
* `script/lint` — run `golangci-lint run ./...` at the exact version CI
|
||||
uses, by running the digest-pinned `golangci-lint` image declared by
|
||||
the `Dockerfile` lint stage (requires Docker; it fails loudly rather
|
||||
|
||||
Reference in New Issue
Block a user