mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-13 11:40:53 +08:00
agent, db, server and evidence serialized on one shared test database via an advisory lock, while evidence, llmrec and traffic-style packages could still run against it in parallel; under full-suite load that window produced a real SQLSTATE 40P01 deadlock in the blackboard direct-source test. TestMain in every PG-using package now rewrites ARTEX_PG_DSN to a per-package database (created automatically by ensureDatabase), so packages neither contend nor need to serialize; the advisory lock stays as an in-package safety net. llmrec gains the TestMain it lacked, which also gives its requires-isolated-DSN tests a truly isolated database inside ./... runs.
17 lines
363 B
Go
17 lines
363 B
Go
package llmrec
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/Autumn-27/artex/db"
|
|
)
|
|
|
|
// Run against this package's own database (db.SuffixTestDatabase, #80): the
|
|
// recorder tests require an isolated ARTEX_PG_DSN, and the suffix gives them
|
|
// one even inside a full parallel ./... run.
|
|
func TestMain(m *testing.M) {
|
|
db.SuffixTestDatabase("llmrec")
|
|
os.Exit(m.Run())
|
|
}
|