Trait testcontainers::runners::SyncRunner

source ·
pub trait SyncRunner<I: Image> {
    // Required methods
    fn start(self) -> Result<Container<I>>;
    fn pull_image(self) -> Result<RunnableImage<I>>;
Available on crate feature blocking only.
Expand description

Helper trait to start containers synchronously.


use testcontainers::{core::WaitFor, runners::SyncRunner, GenericImage};

fn test_redis() {
    let container = GenericImage::new("redis", "7.2.4")
        .with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))

Required Methods§


fn start(self) -> Result<Container<I>>

Starts the container and returns an instance of Container.


fn pull_image(self) -> Result<RunnableImage<I>>

Pulls the image from the registry. Useful if you want to pull the image before starting the container.



impl<T, I> SyncRunner<I> for T
where T: Into<RunnableImage<I>> + Send, I: Image,