TestcontainerEx.ContainerConfig (testcontainer_ex v0.9.0)

Copy Markdown View Source

Shared helpers for container configuration structs.

Provides a macro using_container_config/1 that injects the standard with_check_image/2 and with_reuse/1 setter functions into a container module. Every container struct is expected to have a check_image and a reuse field.

Example

defmodule MyContainer do
  use TestcontainerEx.ContainerConfig

  defstruct [:name, check_image: nil, reuse: false, ...]
end

After the use call the module will have with_check_image/2 and with_reuse/1 defined, matching the behaviour that was previously copy-pasted into every container file.

Summary

Functions

Injects with_check_image/2 and with_reuse/1 into the calling module.

Functions

__using__(opts)

(macro)

Injects with_check_image/2 and with_reuse/1 into the calling module.

The macro expects the calling module to define a struct that includes the :check_image and :reuse keys.