Documentation
¶
Overview ¶
Package testvault provides shared, per-process test fixtures for the research vault. It builds the vault index once per test binary and hands out fresh copies to individual tests, cutting package-level test time from N*rebuild to 1*rebuild + N*file-copy. Test-only; not imported by production code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenSharedDB ¶
OpenSharedDB copies the shared, pre-built DB to dstPath and opens it for exclusive use by the caller's test. The caller owns the returned *index.DB and is responsible for closing it (typically via t.Cleanup).
func SharedIndexDBPath ¶
SharedIndexDBPath returns the filesystem path of an index DB built from vaultPath, rebuilt exactly once per test process. Callers must NOT mutate the returned file — use OpenSharedDB to obtain a writable per-test copy.
The first caller's vaultPath wins for the process lifetime; a subsequent call with a different vaultPath fails loudly rather than silently returning the first vault's DB. Every caller in this repo uses the same research vault, so the single-path lock is the honest contract.
WAL/SHM sidecars are intentionally not copied: Indexer.Rebuild closes the only DB handle before returning, which triggers SQLite's default WAL checkpoint/truncation, leaving all committed state in the main .db file. If a future change keeps the DB open after Rebuild, or disables wal_autocheckpoint, the sidecars would need to be copied too — otherwise per-test copies silently lose the tail of the rebuild.
Types ¶
This section is empty.