Core Rule Set tests: only the concurrency test runs with the race detector (closes #306)
check / check (push) Successful in 4m1s

The race pass runs TestConcurrentRequestsKeepTheirOwnExclusions alone of
internal/coreruleset's tests; every other test of the package moves to the
pass that runs the recorded requests, without the race detector. Other
packages run under -race as before. The 90-second limit stays.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-10 22:49:04 +00:00
1 parent f64752e3b7
commit b40a49d359
2 files changed
+26 -7

No files matched your search

+20 -5
View File
@@ -42,20 +42,35 @@ RUN go mod tidy -diff || \
# Go's build cache is kept on a tmpfs, out of the image: nothing uses it
# after this step, and writing it into the image takes seconds. The tests
# are built with the no_fs_access tag, as the binary is in the build stage.
#
# The race detector finds bugs only in code that runs in several goroutines
# at once. Of the Core Rule Set's tests, only
# TestConcurrentRequestsKeepTheirOwnExclusions inspects requests that way,
# so it is the only one of them in this pass. The second pass runs the rest.
FROM test-setup AS test-race
RUN --mount=type=tmpfs,target=/root/.cache/go-build \
go test -tags no_fs_access -timeout 90s -race -cover ./... || \
others="$(go list ./... | grep -vxF sneak.berlin/go/smallwebwaf/internal/coreruleset)"; \
{ go test -tags no_fs_access -timeout 90s -race -cover $others && \
go test -tags no_fs_access -timeout 90s -race -cover \
-run '^TestConcurrentRequestsKeepTheirOwnExclusions$' ./internal/coreruleset; } || \
{ echo "--- Rerunning with -v for details ---"; \
go test -tags no_fs_access -timeout 90s -race -v ./...; exit 1; }
go test -tags no_fs_access -timeout 90s -race -v $others; \
go test -tags no_fs_access -timeout 90s -race -v \
-run '^TestConcurrentRequestsKeepTheirOwnExclusions$' ./internal/coreruleset; \
exit 1; }
# Second pass: the recorded requests, too slow for make test under -race.
# Second pass: every other test of the Core Rule Set, the recorded requests
# among them, without the race detector.
FROM test-setup AS test-recorded
RUN --mount=type=tmpfs,target=/root/.cache/go-build \
go test -tags no_fs_access,recorded -timeout 90s -cover -run '^TestOrdinary' ./internal/coreruleset/... || \
go test -tags no_fs_access,recorded -timeout 90s -cover \
-skip '^TestConcurrentRequestsKeepTheirOwnExclusions$' ./internal/coreruleset || \
{ echo "--- Rerunning with -v for details ---"; \
go test -tags no_fs_access,recorded -timeout 90s -run '^TestOrdinary' -v ./internal/coreruleset/...; exit 1; }
go test -tags no_fs_access,recorded -timeout 90s -v \
-skip '^TestConcurrentRequestsKeepTheirOwnExclusions$' ./internal/coreruleset; \
exit 1; }
# The test phase that script/test and the build stage name. Nothing is
# wanted from the two passes; the copies are what make BuildKit run them.