Compile once, outside the timed test step, so make test with -race fits the 60-second cap #124

Closed
opened 2026-10-06 03:46:30 +02:00 by clawbot · 1 comment
Collaborator

With the slow tests fixed (#123), make test with -race in script/cibuild takes 59 s on a quiet host and 86 s on a loaded one. Most of that is not testing: go vet and compiling the standard library and every dependency with -race from nothing on every run, because the container starts with an empty Go build cache. sneak's ruling on #52 requires make test with -race inside the 60-second hard cap, aiming for 20 s.

Definition of done

  • The -race (and plain) compilation of the standard library and the module's dependencies happens before the timed make test step and is reused across runs, by the plainest means that works both locally and on the Gitea runner. Two candidates: a Dockerfile step after go mod download that builds the dependencies with -race (cached as a layer until go.mod/go.sum change), or a BuildKit cache mount for Go's build cache on the check steps. Pick one, say why in the PR body.
  • Test results are never served from a cache: if Go's test cache could be reused, script/test passes -count=1.
  • Nothing weakened: same checks, same packages, no skips.
  • make test with -race (added locally for the measurement, not committed; enabling it is #32) fits inside 60 s in script/cibuild on this shared host, measured twice; the PR body gives both times in one line.
  • TODO.md updated. This blocks #32.

Model: opus-5-5

With the slow tests fixed (https://git.eeqj.de/sneak/secret/pulls/123), `make test` with `-race` in `script/cibuild` takes 59 s on a quiet host and 86 s on a loaded one. Most of that is not testing: `go vet` and compiling the standard library and every dependency with `-race` from nothing on every run, because the container starts with an empty Go build cache. sneak's ruling on https://git.eeqj.de/sneak/secret/issues/52 requires `make test` with `-race` inside the 60-second hard cap, aiming for 20 s. ## Definition of done - The `-race` (and plain) compilation of the standard library and the module's dependencies happens before the timed `make test` step and is reused across runs, by the plainest means that works both locally and on the Gitea runner. Two candidates: a Dockerfile step after `go mod download` that builds the dependencies with `-race` (cached as a layer until `go.mod`/`go.sum` change), or a BuildKit cache mount for Go's build cache on the check steps. Pick one, say why in the PR body. - Test results are never served from a cache: if Go's test cache could be reused, `script/test` passes `-count=1`. - Nothing weakened: same checks, same packages, no skips. - `make test` with `-race` (added locally for the measurement, not committed; enabling it is https://git.eeqj.de/sneak/secret/issues/32) fits inside 60 s in `script/cibuild` on this shared host, measured twice; the PR body gives both times in one line. - `TODO.md` updated. This blocks https://git.eeqj.de/sneak/secret/issues/32. Model: opus-5-5
Author
Collaborator

#125 runs make test in the Dockerfile with Go's build cache in a cache mount that docker keeps between builds, so it compiles only what changed since the last build; script/test passes -count=1, so every test still runs. With -race added locally, make test fits inside 60 s in script/cibuild; the PR body has both times. A build with an empty cache, such as the first after docker's build cache is cleared, still compiles everything inside make test.

Model: opus-5-5

https://git.eeqj.de/sneak/secret/pulls/125 runs `make test` in the `Dockerfile` with Go's build cache in a cache mount that docker keeps between builds, so it compiles only what changed since the last build; `script/test` passes `-count=1`, so every test still runs. With `-race` added locally, `make test` fits inside 60 s in `script/cibuild`; the PR body has both times. A build with an empty cache, such as the first after docker's build cache is cleared, still compiles everything inside `make test`. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/secret#124