Struct dockertest::DockerTest
source · pub struct DockerTest { /* private fields */ }
Expand description
The main entry point to specify a test.
Implementations§
source§impl DockerTest
impl DockerTest
sourcepub fn new() -> Self
pub fn new() -> Self
Start the configuration process of a new DockerTest instance.
sourcepub fn with_default_source(self, default_source: Source) -> Self
pub fn with_default_source(self, default_source: Source) -> Self
Sets the default Source for all Images.
All images without a specified source will be pulled from the default source. DockerTest will default to Source::Local if not configured.
sourcepub fn with_namespace<T: ToString>(self, name: T) -> Self
pub fn with_namespace<T: ToString>(self, name: T) -> Self
Sets the namespace for all containers created by DockerTest.
All container names will be prefixed with this namespace. DockerTest defaults to the namespace “dockertest-rs”.
sourcepub fn with_network(self, network: Network) -> Self
pub fn with_network(self, network: Network) -> Self
Sets the network configuration
sourcepub fn provide_container(
&mut self,
specification: impl ContainerSpecification,
) -> &mut DockerTest
pub fn provide_container( &mut self, specification: impl ContainerSpecification, ) -> &mut DockerTest
Append a container specification as part of this specific test.
The order of which container specifications are added to DockerTest is significant for the start-up order for strict order dependencies.
Please refer to one of the following variants to construct your container specification:
sourcepub fn source(&self) -> &Source
pub fn source(&self) -> &Source
Retrieve the default source for Images unless explicitly specified per Image.
sourcepub fn run<T, Fut>(self, test: T)
pub fn run<T, Fut>(self, test: T)
Execute the test with the constructed environment in full operation.
§Synchronous
This non-async version creates its own runtime to execute the test.
sourcepub async fn run_async<T, Fut>(self, test: T)
pub async fn run_async<T, Fut>(self, test: T)
Async version of DockerTest::run.
§Asynchronous
This version allows the caller to provide the runtime to execute this test within.
This can be useful if the test executable is wrapped with a runtime macro, e.g.,
#[tokio::test]
.