Skip to main content

connect_in_memory

Function connect_in_memory 

Source
pub async fn connect_in_memory() -> DbResult<SqlitePool>
Expand description

Opens a private, in-process database for tests: same pragmas and migrations as connect, but nothing touches disk.

Capped at one pooled connection deliberately — a pooled in-memory SQLite database is private per-connection, so a second connection would see an empty database rather than the same one. That cap is what makes “in-memory” behave like a single shared database across a test. WAL itself requires a real file (SQLite silently falls back to its in-memory journal mode here regardless of the request below), so WAL is only actually exercised by connect’s own tests, which use a real temp file.