pub struct Test { /* private fields */ }Expand description
Wraps the Tokio runtime and ensures cleanup happens.
This also passes necessary
Implementations§
Source§impl Test
impl Test
pub fn new(setup: Arc<dyn Setup>) -> Self
Sourcepub async fn try_setup_db(&mut self, models: ModelSet) -> Result<Db>
pub async fn try_setup_db(&mut self, models: ModelSet) -> Result<Db>
Try to setup a database with models, returns Result for error handling
Sourcepub async fn try_setup_db_with(
&mut self,
models: ModelSet,
customize: impl FnOnce(&mut Builder),
) -> Result<Db>
pub async fn try_setup_db_with( &mut self, models: ModelSet, customize: impl FnOnce(&mut Builder), ) -> Result<Db>
Try to setup a database with models, allowing the caller to customize
the toasty::db::Builder before it is built (e.g., to set pool
configuration).
Sourcepub async fn setup_db(&mut self, models: ModelSet) -> Db
pub async fn setup_db(&mut self, models: ModelSet) -> Db
Setup a database with models, always with logging enabled
Sourcepub async fn setup_db_with(
&mut self,
models: ModelSet,
customize: impl FnOnce(&mut Builder),
) -> Db
pub async fn setup_db_with( &mut self, models: ModelSet, customize: impl FnOnce(&mut Builder), ) -> Db
Setup a database, applying the given customization to the
toasty::db::Builder before building.
Sourcepub fn capability(&self) -> &'static Capability
pub fn capability(&self) -> &'static Capability
Get the driver capability
Sourcepub fn log(&self) -> &InstrumentedHandle
pub fn log(&self) -> &InstrumentedHandle
Get the instrumented-driver control handle. The handle exposes the operation log (for assertions) and fault injection.
Sourcepub fn inject_fault(&self, fault: Fault)
pub fn inject_fault(&self, fault: Fault)
Queue a fault to fire on the next driver exec call. Faults
fire in FIFO order. Only useful after setup_db has installed
the instrumented driver.
Sourcepub fn set_serial(&mut self, serial: bool)
pub fn set_serial(&mut self, serial: bool)
Set whether this test requires exclusive (serial) execution