From e9a10bb509aa17d8d3b06d239e2fce3fbbbfbb14 Mon Sep 17 00:00:00 2001 From: tbphp Date: Fri, 18 Sep 2026 13:05:49 +0800 Subject: [PATCH] test(ci): reduce race gate overhead (#688) --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- internal/storage/affinity_kind_migration_test.go | 5 +++++ internal/storage/quota_history_migration_test.go | 7 +++++++ internal/webui/workflow_test.go | 4 ++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 768b36c7..3899059e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: cache: false - name: Run race-enabled tests - run: go test -race -count=1 -timeout=15m . ./internal/... + run: go test -race -vet=off -count=1 -timeout=15m . ./internal/... race-cpa: runs-on: [self-hosted, Linux, ARM64] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e076a8ce..babf87e1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -223,7 +223,7 @@ jobs: cache: false - name: Run race-enabled tests - run: go test -race -count=1 -timeout=15m . ./internal/... + run: go test -race -vet=off -count=1 -timeout=15m . ./internal/... race-cpa: needs: validate-tag diff --git a/internal/storage/affinity_kind_migration_test.go b/internal/storage/affinity_kind_migration_test.go index 339b94b2..dc2830d0 100644 --- a/internal/storage/affinity_kind_migration_test.go +++ b/internal/storage/affinity_kind_migration_test.go @@ -9,6 +9,8 @@ import ( ) func TestAffinityKindMigrationContract(t *testing.T) { + t.Parallel() + testAffinityKindMigration(t, openInternalMigrationTestDatabase) } func TestExternalAffinityKindMigrationContract(t *testing.T) { @@ -22,6 +24,9 @@ func testAffinityKindMigration(t *testing.T, open func(*testing.T) *gorm.DB) { for _, scenario := range []string{"fresh", "upgrade", "interrupted"} { t.Run(scenario, func(t *testing.T) { db := open(t) + if db.Dialector.Name() == "sqlite" { + t.Parallel() + } if scenario != "fresh" { if err := applyMigrationRegistry(db, migrations[:13]); err != nil { t.Fatal(err) diff --git a/internal/storage/quota_history_migration_test.go b/internal/storage/quota_history_migration_test.go index 04602d7b..976fa48b 100644 --- a/internal/storage/quota_history_migration_test.go +++ b/internal/storage/quota_history_migration_test.go @@ -11,6 +11,8 @@ import ( ) func TestQuotaHistoryMigrationCreatesQueryableHistory(t *testing.T) { + t.Parallel() + db := openInternalMigrationTestDatabase(t) if err := applyMigrations(db); err != nil { t.Fatal(err) @@ -29,6 +31,8 @@ func TestQuotaHistoryMigrationCreatesQueryableHistory(t *testing.T) { } func TestQuotaHistoryMigrationContract(t *testing.T) { + t.Parallel() + testQuotaHistoryMigration(t, openInternalMigrationTestDatabase) } @@ -44,6 +48,9 @@ func testQuotaHistoryMigration(t *testing.T, open func(*testing.T) *gorm.DB) { for _, scenario := range []string{"fresh", "upgrade", "interrupted"} { t.Run(scenario, func(t *testing.T) { db := open(t) + if db.Dialector.Name() == "sqlite" { + t.Parallel() + } if scenario != "fresh" { if err := applyMigrationRegistry(db, migrations[:15]); err != nil { t.Fatal(err) diff --git a/internal/webui/workflow_test.go b/internal/webui/workflow_test.go index b9f3cd1c..3d6884e2 100644 --- a/internal/webui/workflow_test.go +++ b/internal/webui/workflow_test.go @@ -195,7 +195,7 @@ func TestBranchAndReleaseWorkflowsRunRaceInParallelGates(t *testing.T) { t, workflowJobBlock(t, content, "race-tests"), "Run race-enabled tests", - "go test -race -count=1 -timeout=15m . ./internal/...", + "go test -race -vet=off -count=1 -timeout=15m . ./internal/...", ) branchCPA := workflowStepBlock( t, @@ -224,7 +224,7 @@ func TestBranchAndReleaseWorkflowsRunRaceInParallelGates(t *testing.T) { t, workflowJobBlock(t, releaseContent, "race-tests"), "Run race-enabled tests", - "go test -race -count=1 -timeout=15m . ./internal/...", + "go test -race -vet=off -count=1 -timeout=15m . ./internal/...", ) releaseCPA := workflowStepBlock( t,