From ee75d498e65003fb07690c038bb9035021cd9dee Mon Sep 17 00:00:00 2001 From: viettranx Date: Sat, 11 Apr 2026 23:17:33 +0700 Subject: [PATCH] ci: cap go test -timeout to 90s to bound CI hang impact MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deadlocked tests previously blocked CI for the full 10-minute Go default before failing. Wave C had a live example: a test timeout branch using `<-t.Context().Done()` (which never fires until test return) combined with a dispatch-suppressing patch caused a 10-min GH Actions stall. Cap every test binary at 90s. Wave C race-heavy suites run in <20s locally, so 90s leaves ample breathing room while failing fast on any future deadlock. Applied to both CI workflow and Makefile so local `make test` enforces the same bound. Unit-level defenses (proper `time.After` timeouts in tests) are still the right fix — this is a safety net, not a substitute. --- .github/workflows/ci.yaml | 5 ++++- Makefile | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 251b70e2..c570bcd8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,10 @@ jobs: - run: go build ./... - run: go build -tags sqliteonly ./... - run: go vet ./... - - run: go test -race -coverpkg=./... -coverprofile=coverage.out ./... + # -timeout=90s caps each test binary so a deadlocked test fails fast + # instead of blocking CI for the 10-minute default. Race-heavy wave C + # suites run in <20s, so 90s leaves ample breathing room. + - run: go test -race -timeout=90s -coverpkg=./... -coverprofile=coverage.out ./... - name: Coverage summary run: go tool cover -func=coverage.out | tail -1 - name: Coverage ratchet gate diff --git a/Makefile b/Makefile index f8ef7ac8..a90734dc 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ reset: version-file $(COMPOSE) up -d --build test: - go test -race ./... + go test -race -timeout=90s ./... vet: go vet ./...