//! What the integration tests in this crate share. //! //! The unit tests reach `crate::test_support`; an integration test links the //! library as an outside crate and cannot see a `#[cfg(test)]` module, so the //! one thing they both need lives here as well. use std::path::Path; /// Open a fixture database — one a test writes, reads back, and throws away. /// /// The same rule, and the same measurement, as /// `cotton-client/src/test_support.rs`: SQLite's default `synchronous = FULL` /// with one autocommit per statement costs an `fsync` per `INSERT`, about a /// second each on the CI box's shared disk under a full nextest pool. A fixture /// in a `tempfile::tempdir()` is deleted when its test ends and no other process /// ever opens it, so the durability it is paying for does not exist. pub fn open_fixture_db(path: &Path) -> rusqlite::Connection { let db = rusqlite::Connection::open(path).expect("a fixture database"); db.pragma_update(None, "synchronous", "OFF") .expect("a fixture does not fsync"); db }