Run the tests under the race detector, in Docker (closes #23) #40

Merged
clawbot merged 1 commits from issue-23-race-in-docker into next 2026-10-06 13:48:24 +02:00
Collaborator

Implements #23.

script/test is now a byte copy of the standard script. It builds only the test stage of the Dockerfile, without the build cache, so tests no longer run on the host. That stage calls go test -timeout 90s -race -cover ./... directly, with the standard -v rerun on failure, because make test is itself a docker build of the stage. The stage stays on the Debian-based golang image, since -race needs cgo and a C toolchain, which an alpine image lacks.

The test stage no longer copies from the lint stage, so script/test runs the tests alone. Docker builds a stage that is not last only when the final stage depends on it or --target names it, so a new final stage copies one file from each. Those two copies are its only content, and they are what make a plain docker build, and so script/cibuild, run both stages.

The README entry for script/test and TODO.md now say what runs. Go is still installed on the host by script/bootstrap, for script/fmt, script/fmt-check and the go mod tidy check in script/precommit.

Judgement call: the vendored REPO_POLICIES.md still describes the older Dockerfile pattern; it is a copy of the standard and is left alone.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/simplelog/issues/23. `script/test` is now a byte copy of the standard script. It builds only the `test` stage of the `Dockerfile`, without the build cache, so tests no longer run on the host. That stage calls `go test -timeout 90s -race -cover ./...` directly, with the standard `-v` rerun on failure, because `make test` is itself a docker build of the stage. The stage stays on the Debian-based `golang` image, since `-race` needs cgo and a C toolchain, which an alpine image lacks. The `test` stage no longer copies from the `lint` stage, so `script/test` runs the tests alone. Docker builds a stage that is not last only when the final stage depends on it or `--target` names it, so a new final stage copies one file from each. Those two copies are its only content, and they are what make a plain `docker build`, and so `script/cibuild`, run both stages. The README entry for `script/test` and `TODO.md` now say what runs. Go is still installed on the host by `script/bootstrap`, for `script/fmt`, `script/fmt-check` and the `go mod tidy` check in `script/precommit`. Judgement call: the vendored `REPO_POLICIES.md` still describes the older `Dockerfile` pattern; it is a copy of the standard and is left alone. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 12:59:45 +02:00
clawbot self-assigned this 2026-10-06 12:59:45 +02:00
clawbot added 1 commit 2026-10-06 12:59:46 +02:00
Run the tests under the race detector, in Docker (closes #23)
check / check (push) Successful in 20s
check / check (pull_request) Successful in 24s
3bf2079492
script/test is now the standard script: it builds only the test stage
of the Dockerfile, without the build cache, so tests no longer run on
the host. That stage calls go test -race -cover directly, with a
verbose rerun on failure, on the Debian-based golang image, which has
the C toolchain -race needs.

The test stage no longer copies from the lint stage, so script/test
builds the tests alone. A new final stage copies one file from each of
the two stages; that is what makes a plain docker build, and so
script/cibuild, run both. The README entry for script/test and TODO.md
say what now runs.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 9b3d7326ce into next 2026-10-06 13:48:24 +02:00
clawbot deleted branch issue-23-race-in-docker 2026-10-06 13:48:24 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/simplelog#40