testcontainer_compose

Types

pub opaque type ComposeConfig
pub opaque type ComposeServices
pub type Service {
  Service(name: String, image: String, ports: List(#(Int, Int)))
}

Constructors

  • Service(name: String, image: String, ports: List(#(Int, Int)))

Values

pub fn from_file(file_path: String) -> ComposeConfig
pub fn parse_services_json(
  path: String,
  json_str: String,
) -> Result(List(Service), error.Error)

Parse a docker compose config --format json output string into typed Service records. Exposed for testability — useful when you have a pre-rendered compose JSON and want to validate parsing without Docker.

path is only used to enrich error messages.

pub fn service_by_name(
  stack: ComposeServices,
  name: String,
) -> option.Option(Service)
pub fn service_image(svc: Service) -> String
pub fn service_name(svc: Service) -> String
pub fn service_ports(svc: Service) -> List(#(Int, Int))
pub fn services(stack: ComposeServices) -> List(Service)
pub fn with_compose(
  cfg: ComposeConfig,
  body: fn(ComposeServices) -> Result(a, error.Error),
) -> Result(a, error.Error)

Spin up a compose stack, run the body, and always tear it down.

pub fn with_env_override(
  cfg: ComposeConfig,
  key: String,
  value: String,
) -> ComposeConfig
pub fn with_project_name(
  cfg: ComposeConfig,
  project_name: String,
) -> ComposeConfig
Search Document