ci: Test runs internal/gateway in chunks, one process per core, as Race does (#2191)

f1c9014cd's macOS Test run went red with internal/gateway past go test's
30m alarm while the test then running was 1s in: no test hung, the
package as a whole ran out. Its tests run one at a time (t.Setenv rules
out t.Parallel), and the package grew from 450-600s on macOS runners
(10-28, 56602426d) to 965s on the green run before, and 892s for 4286
tests on mote, none over 20s. A longer timeout would be met again the
same way; Race already runs the same tests in chunks through
build/race-shards.sh (#5361).

The Test step now runs every other package as before, and the gateway's
plain test binary through race-shards.sh. The plain run stays: it sends
the full 64 MB bodies and runs the pool tests -race skips (raceOn).

Run on mote at this change (origin/main a5e3972a7):
- go test -c ./internal/gateway/, then build/race-shards.sh with 18
  workers and -test.timeout=20m: 4300 tests in 135 chunks, 125s, exit 0
  (twice; the second run's status taken from the script, not a pipe)
- go list ./... | grep -v '/internal/gateway$': 121 packages, the
  gateway's subpackage kept
Not run: the workflow itself; this push's own Test run is its check,
on Linux (gtk3 tags) and macOS.
This commit is contained in:
yetone
2026-11-15 08:05:40 +08:00
parent a5e3972a71
commit 0dbdc7481c
2 changed files with 14 additions and 4 deletions
+11 -3
View File
@@ -65,11 +65,19 @@ jobs:
with:
bun-version: 1.4.2
# internal/gateway takes 450-600s on macOS runners, and go test's
# default 10m timed it out in 3 of 8 finished main runs (#2108).
# internal/gateway's tests run one at a time (t.Setenv rules out
# t.Parallel): 892s on mote for 4286 tests on 11-15, none over 20s,
# 965s on macOS CI, and past the 30m alarm on f1c9014cd with no test
# hung (#2191). It grew from 450-600s on 10-28, so a longer timeout
# would only be met again. Its plain run goes in chunks, one process
# per core, as the Race step's does; the other packages run as before.
- name: Test
if: runner.os != 'Windows'
run: go test -timeout 30m -tags "${{ steps.tags.outputs.tags }}" ./...
shell: bash
run: |
go test -timeout 30m -tags "${{ steps.tags.outputs.tags }}" $(go list -tags "${{ steps.tags.outputs.tags }}" ./... | grep -v '/internal/gateway$')
go test -c -o "$RUNNER_TEMP/gateway.test" -tags "${{ steps.tags.outputs.tags }}" ./internal/gateway/
build/race-shards.sh internal/gateway "$RUNNER_TEMP/gateway.test" "$(getconf _NPROCESSORS_ONLN)" -test.timeout=20m
# Windows skips the Test step above, so the two plugin stderr tests run
# here. The end-to-end one needs bun on PATH; without it it skips.
+3 -1
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# race-shards.sh DIR BIN N [FLAGS]: runs the tests of BIN, a package's test
# binary (go test -c), from the package's DIR in N processes at once, and
# binary (go test -c, with -race or without: CI's Test step runs the
# gateway's plain binary through it too, #2191), from the package's DIR in N
# processes at once, and
# fails if any test process does. FLAGS go to every process. A package's
# tests run one at a time unless they call t.Parallel, which t.Setenv rules
# out, so the gateway's suite under the race detector keeps one core busy;