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 <noreply@anthropic.com>
This commit is contained in:
Mikkel Georgsen 2026-03-01 08:16:50 +01:00
parent 14e405c101
commit 968a38dd87

View file

@ -15,7 +15,7 @@ import (
// testDB creates an in-memory SQLite database with the required schema. // testDB creates an in-memory SQLite database with the required schema.
func testDB(t *testing.T) *sql.DB { func testDB(t *testing.T) *sql.DB {
t.Helper() t.Helper()
db, err := sql.Open("libsql", "file::memory:?cache=shared") db, err := sql.Open("libsql", "file:"+t.Name()+"?mode=memory")
if err != nil { if err != nil {
t.Fatalf("open test db: %v", err) t.Fatalf("open test db: %v", err)
} }