From 3e948eedbe0764c78a683cfeeb3fe629451e6b45 Mon Sep 17 00:00:00 2001 From: tbphp Date: Tue, 11 Aug 2026 16:32:43 +0800 Subject: [PATCH] =?UTF-8?q?test(ci):=20=E7=A8=B3=E5=AE=9A=E8=BF=9C?= =?UTF-8?q?=E7=AB=AF=20race=20=E9=97=A8=E7=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- internal/requestlog/service_test.go | 9 ++++----- internal/webui/workflow_test.go | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28226655..013c52ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: run: go build -o gpt-load . - name: Run race-enabled tests - run: go test -race -count=1 . ./internal/... + run: go test -race -count=1 -timeout=15m . ./internal/... - name: Check repository invariants run: git diff --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59969d3e..a5610ff7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -109,7 +109,7 @@ jobs: run: go build -trimpath -o gpt-load . - name: Run race-enabled tests - run: go test -race -count=1 . ./internal/... + run: go test -race -count=1 -timeout=15m . ./internal/... - name: Check repository invariants run: git diff --check diff --git a/internal/requestlog/service_test.go b/internal/requestlog/service_test.go index 331819cd..44635695 100644 --- a/internal/requestlog/service_test.go +++ b/internal/requestlog/service_test.go @@ -500,7 +500,7 @@ func TestEmitPersistsGatewayFrozenQuoteWithoutRepricing(t *testing.T) { EstimatedCostNanoUSD: 1_000_000_000, } service.Emit(eventA) - timer := receiveValue(t, timers.created) + receiveValue(t, timers.created) entries := processLogEntries(t, output.Bytes()) if len(entries) != 1 || entries[0]["cost_usd"] != "1" { @@ -523,7 +523,9 @@ func TestEmitPersistsGatewayFrozenQuoteWithoutRepricing(t *testing.T) { EstimatedCostNanoUSD: 2_000_000_000, } service.Emit(eventB) - timer.Fire() + if err := service.Stop(context.Background()); err != nil { + t.Fatalf("Stop() error = %v", err) + } rows := receiveValue(t, writes) if len(rows) != 2 || rows[0].ID != "snapshot-a" || @@ -532,7 +534,4 @@ func TestEmitPersistsGatewayFrozenQuoteWithoutRepricing(t *testing.T) { rows[1].EstimatedCostNanoUSD != 2_000_000_000 { t.Fatalf("snapshot-priced rows = %+v, want A/1000000000 then B/2000000000", rows) } - if err := service.Stop(context.Background()); err != nil { - t.Fatalf("Stop() error = %v", err) - } } diff --git a/internal/webui/workflow_test.go b/internal/webui/workflow_test.go index c0ea379f..219fb32a 100644 --- a/internal/webui/workflow_test.go +++ b/internal/webui/workflow_test.go @@ -69,7 +69,7 @@ func TestBranchCIContainsStaticGoAndRaceEnabledBackendGates(t *testing.T) { {name: "Check module graph", run: "go mod tidy -diff"}, {name: "Audit Go dependencies", run: "go run golang.org/x/vuln/cmd/govulncheck@v1.1.4 ./..."}, {name: "Run Go vet", run: "go vet ./..."}, - {name: "Run race-enabled tests", run: "go test -race -count=1 . ./internal/..."}, + {name: "Run race-enabled tests", run: "go test -race -count=1 -timeout=15m . ./internal/..."}, {name: "Check repository invariants", run: "git diff --check"}, } { assertWorkflowGateStep(t, testJob, test.name, test.run) @@ -84,7 +84,7 @@ func TestBranchCIContainsStaticGoAndRaceEnabledBackendGates(t *testing.T) { t, releaseJob, "Run race-enabled tests", - "go test -race -count=1 . ./internal/...", + "go test -race -count=1 -timeout=15m . ./internal/...", ) }