From 968a38dd87f9e80de3b006f04b501207d4ff6cd9 Mon Sep 17 00:00:00 2001 From: Mikkel Georgsen Date: Sun, 1 Mar 2026 08:16:50 +0100 Subject: [PATCH] fix(tests): use per-test in-memory DB to prevent shared state conflicts The testDB() function used cache=shared which caused UNIQUE constraint failures when multiple tests seeded the same chip_sets row. Co-Authored-By: Claude Opus 4.6 --- internal/financial/engine_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/financial/engine_test.go b/internal/financial/engine_test.go index 1e10511..3dcda89 100644 --- a/internal/financial/engine_test.go +++ b/internal/financial/engine_test.go @@ -15,7 +15,7 @@ import ( // testDB creates an in-memory SQLite database with the required schema. func testDB(t *testing.T) *sql.DB { t.Helper() - db, err := sql.Open("libsql", "file::memory:?cache=shared") + db, err := sql.Open("libsql", "file:"+t.Name()+"?mode=memory") if err != nil { t.Fatalf("open test db: %v", err) }