Packages
TestcontainerEx is an Elixir library for integration testing with containerized services. Start, stop, and monitor Docker, Podman, Minikube, Colima, or Apple Container containers with a unified API. Supports custom containers.
Current section
Files
Jump to
Current section
Files
lib/pull_policy.ex
defmodule TestcontainerEx.PullPolicy do
@moduledoc """
Pull policies that control whether an image is fetched from a remote registry
before starting a container.
"""
alias TestcontainerEx.PullPolicy
@type t :: %__MODULE__{
always_pull: boolean() | nil,
pull_if_missing: boolean() | nil,
pull_condition: (struct(), Tesla.Env.t() -> boolean()) | nil
}
defstruct [:always_pull, :pull_if_missing, :pull_condition]
@spec always_pull() :: PullPolicy.t()
def always_pull do
%__MODULE__{always_pull: true}
end
@spec never_pull() :: PullPolicy.t()
def never_pull do
%__MODULE__{}
end
@spec pull_if_missing() :: PullPolicy.t()
def pull_if_missing do
%__MODULE__{pull_if_missing: true}
end
@spec pull_condition(
expr ::
(config :: struct(), conn :: Tesla.Env.t() -> true | false)
) ::
PullPolicy.t()
def pull_condition(expr) do
%__MODULE__{pull_condition: expr}
end
end