ci: the gateway's race suite runs over one process per core, not one at a time (wizzy-yang, #923)
The Race step took 690s on ubuntu and 908s on macOS, almost all of it internal/gateway: its 1046 tests can't call t.Parallel (t.Setenv rules it out), so the package ran on one core under the race detector. build/race-shards.sh compiles nothing itself: it takes the package's race test binary (go test -race -c), splits its tests round-robin by name over N processes run at once, prints each process's log in a folded group and fails when any does. The gateway's TestMain already isolates every process in its own temporary home, keychain stand-ins and PATH, so the processes share nothing. The step runs it with one process per core (getconf _NPROCESSORS_ONLN: 4 on ubuntu, 3 on macOS), the same -race binary and the same 20-minute timeout; redact keeps its own go test -race. Every test still runs under the race detector, once. Locally (Apple silicon, 4 processes) the gateway's race suite passed in 4:39 against 567s of test time run one after another; one test, TestLargeRequestEndpoints (seven 64 MB bodies, 198s), now bounds it.
This commit is contained in:
@@ -62,12 +62,16 @@ jobs:
|
||||
go test -timeout 10m -tags "${{ steps.tags.outputs.tags }}" ./internal/plugin/... -run '^TestFlowBigReplyProd$' -count=1
|
||||
|
||||
# The redaction tests reuse this binary in fresh processes to check
|
||||
# first-use races, so it must include the race detector.
|
||||
# first-use races, so it must include the race detector. The gateway's
|
||||
# tests can't call t.Parallel (t.Setenv), so its suite runs split over
|
||||
# one process per core (#923); each process isolates its own home.
|
||||
- name: Race
|
||||
if: runner.os != 'Windows'
|
||||
# The full gateway suite can exceed Go's default 10-minute package
|
||||
# timeout under the race detector on hosted macOS runners.
|
||||
run: go test -race -timeout 20m -tags "${{ steps.tags.outputs.tags }}" ./internal/gateway/ ./internal/redact/
|
||||
shell: bash
|
||||
run: |
|
||||
go test -race -c -o "$RUNNER_TEMP/gateway.race" -tags "${{ steps.tags.outputs.tags }}" ./internal/gateway/
|
||||
build/race-shards.sh internal/gateway "$RUNNER_TEMP/gateway.race" "$(getconf _NPROCESSORS_ONLN)" -test.timeout=20m
|
||||
go test -race -tags "${{ steps.tags.outputs.tags }}" ./internal/redact/
|
||||
|
||||
# Account usage mixes cached results with concurrent fetches.
|
||||
- name: Race account usage
|
||||
|
||||
Reference in New Issue
Block a user