Documentation
¶
Overview ¶
Package sqlitetest opens SQLite stores for tests with a cheaper setup.
It is for tests only and must not be imported by production code. Opening a fresh state.db applies all migrations, which costs far more under the race detector than the rest of a unit test. OpenState therefore migrates a fresh database once per test binary, keeps its bytes as a template, and copies that template into each new directory. The real sqlite.OpenState still runs on the copy, so schema checks and pragmas are exercised as usual.
Only the state store is templated. The metrics store generates a random incarnation on every new file (ADR 0012 B4), so a copied metrics.db would share its identity with all others. Tests that need metrics stores call sqlite.OpenMetrics directly.
OpenState does not register a cleanup. The caller closes the store, which keeps the close semantics of the helpers it replaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.