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
Auto Trait Implementations§
impl !Freeze for Test
impl !RefUnwindSafe for Test
impl !UnwindSafe for Test
impl Send for Test
impl Sync for Test
impl Unpin for Test
impl UnsafeUnpin for Test
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more