[][src]Trait testcontainers::Image

pub trait Image where
    Self: Sized + Default,
    Self::Args: Default + IntoIterator<Item = String>,
    Self::EnvVars: Default + IntoIterator<Item = (String, String)>,
    Self::Volumes: Default + IntoIterator<Item = (String, String)>,
    Self::EntryPoint: ToString
{ type Args; type EnvVars; type Volumes; type EntryPoint: ?Sized; fn descriptor(&self) -> String;
fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>);
fn args(&self) -> Self::Args;
fn env_vars(&self) -> Self::EnvVars;
fn volumes(&self) -> Self::Volumes;
fn with_args(self, arguments: Self::Args) -> Self; fn with_entrypoint(self, _entryppoint: &Self::EntryPoint) -> Self { ... }
fn entrypoint(&self) -> Option<String> { ... } }

Represents a docker image.

Implementations are required to implement Default. The default instance of an Image should have a meaningful configuration! It should be possible to run the default instance of an Image and get back a working container!

Associated Types

type Args[src]

A type representing the arguments for an Image.

There are a couple of things regarding the arguments of images:

  1. Similar to the Default implementation of an Image, the Default instance of its arguments should be meaningful!
  2. Implementations should be conservative about which arguments they expose. Many times, users will either go with the default arguments or just override one or two. When defining the arguments of your image, consider that the whole purpose is to facilitate integration testing. Only expose those that actually make sense for this case.

type EnvVars[src]

A type representing the environment variables for an Image.

There are a couple of things regarding the arguments of images:

  1. Similar to the Default implementation of an Image, the Default instance of its environment variables should be meaningful!
  2. Implementations should be conservative about which environment variables they expose. Many times, users will either go with the default ones or just override one or two. When defining the environment variables of your image, consider that the whole purpose is to facilitate integration testing. Only expose those that actually make sense for this case.

type Volumes[src]

A type representing the volumes for an Image.

There are a couple of things regarding the arguments of images:

  1. Similar to the Default implementation of an Image, the Default instance of its volumes should be meaningful!
  2. Implementations should be conservative about which volumes they expose. Many times, users will either go with the default ones or just override one or two. When defining the volumes of your image, consider that the whole purpose is to facilitate integration testing. Only expose those that actually make sense for this case.

type EntryPoint: ?Sized[src]

A type representing the entrypoint for an Image.

Loading content...

Required methods

fn descriptor(&self) -> String[src]

The descriptor of the docker image.

This should return a full-qualified descriptor. Implementations are encouraged to include a tag that will not change (i.e. NOT latest) in order to prevent test code from randomly breaking because the underlying docker suddenly changed.

fn wait_until_ready<D: Docker>(&self, container: &Container<'_, D, Self>)[src]

Blocks the current thread until the started container is ready.

This method is the 🍞 and butter of the whole testcontainers library. Containers are rarely instantly available as soon as they are started. Most of them take some time to boot up.

Implementations MUST block the current thread until the passed-in container is ready to be interacted with. The container instance provides access to logs of the container.

Most implementations will very likely want to make use of this to wait for a particular message to be emitted.

fn args(&self) -> Self::Args[src]

Returns the arguments this instance was created with.

fn env_vars(&self) -> Self::EnvVars[src]

Returns the environment variables this instance was created with.

fn volumes(&self) -> Self::Volumes[src]

Returns the volumes this instance was created with.

fn with_args(self, arguments: Self::Args) -> Self[src]

Re-configures the current instance of this image with the given arguments.

Loading content...

Provided methods

fn with_entrypoint(self, _entryppoint: &Self::EntryPoint) -> Self[src]

Re-configures the current instance of this image with the given entrypoint.

fn entrypoint(&self) -> Option<String>[src]

Returns the entrypoint this instance was created with.

Loading content...

Implementors

impl Image for BitcoinCore[src]

type Args = BitcoinCoreImageArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for DynamoDb[src]

type Args = DynamoDbArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for ElasticMQ[src]

type Args = ElasticMQArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for GenericImage[src]

type Args = Vec<String>

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = str

impl Image for Mongo[src]

type Args = MongoArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for OrientDB[src]

type Args = OrientDBArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for ParityEthereum[src]

type Args = ParityEthereumArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for Postgres[src]

type Args = PostgresArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for Redis[src]

type Args = RedisArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for GanacheCli[src]

type Args = GanacheCliArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

impl Image for Zookeeper[src]

type Args = ZookeeperArgs

type EnvVars = HashMap<String, String>

type Volumes = HashMap<String, String>

type EntryPoint = Infallible

Loading content...