Trait testcontainers::runners::SyncRunner
source · pub trait SyncRunner<I: Image> {
// Required methods
fn start(self) -> Result<Container<I>>;
fn pull_image(self) -> Result<ContainerRequest<I>>;
}
Available on crate feature
blocking
only.Expand description
Helper trait to start containers synchronously.
§Example
use testcontainers::{core::{IntoContainerPort, WaitFor}, runners::SyncRunner, GenericImage};
fn test_redis() {
let container = GenericImage::new("redis", "7.2.4")
.with_exposed_port(6379.tcp())
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start()
.unwrap();
}
Required Methods§
sourcefn start(self) -> Result<Container<I>>
fn start(self) -> Result<Container<I>>
Starts the container and returns an instance of Container
.
sourcefn pull_image(self) -> Result<ContainerRequest<I>>
fn pull_image(self) -> Result<ContainerRequest<I>>
Pulls the image from the registry. Useful if you want to pull the image before starting the container.