From e082adf7b699647a2242e0f26d3cb731a5960b52 Mon Sep 17 00:00:00 2001 From: Johnny Date: Wed, 14 Jan 2026 22:50:30 +0800 Subject: [PATCH] fix: set DRIVER=sqlite in CI to prevent TestMain from spawning child processes Problem: - store/test/TestMain checks if DRIVER env var is set - If not set, it runs tests for all 3 drivers (sqlite, mysql, postgres) by spawning child 'go test' processes - This conflicts with t.Parallel() in individual tests - CI workflow didn't set DRIVER, triggering multi-driver execution Solution: - Set DRIVER=sqlite in GitHub Actions workflow - TestMain will run tests once with SQLite driver - Tests run in parallel with t.Parallel() as intended - Avoids spawning child processes and race conditions Why SQLite: - Fastest test execution (no container startup) - Sufficient for CI validation - MySQL/Postgres can be tested locally when needed This fixes the 'table already exists' errors and test flakiness in CI while maintaining parallel execution benefits. --- .github/workflows/backend-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index c4e476f9..82d5e0f8 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -74,6 +74,8 @@ jobs: ./cmd/... ./internal/... ./proto/... ;; esac + env: + DRIVER: sqlite # Use SQLite for fastest test execution - name: Upload coverage if: github.event_name == 'push' && github.ref == 'refs/heads/main'