TestcontainerEx.Debug (testcontainer_ex v0.3.1)

Copy Markdown View Source

Runtime debugging and inspection helpers for TestcontainerEx.

Provides functions to inspect container state, list running containers, dump configuration, and check connectivity — useful from iex -S mix or when debugging failing tests.

Usage

iex> TestcontainerEx.Debug.status()
%{
  connected: true,
  engine: :docker,
  host: "localhost",
  container_ip_mode: false,
  session_id: "A1B2..."
}

iex> {:ok, container} = TestcontainerEx.start_container(redis)
iex> TestcontainerEx.Debug.inspect_container(container)
%{
  container_id: "abc123...",
  image: "redis:7.2-alpine",
  ports: [{6379, 55123}],
  ip_address: "172.17.0.3",
  environment: %{"REDIS_PASSWORD" => "..."},
  labels: %{...}
}

iex> TestcontainerEx.Debug.list_containers()
["abc123...", "def456..."]

Summary

Functions

Returns a human-readable map of a container's runtime state.

Returns the list of tracked container IDs from the server state.

Returns the list of tracked network names from the server state.

Returns a summary of the TestcontainerEx server status.

Returns a formatted string summary of a container for quick console inspection.

Functions

inspect_container(container)

@spec inspect_container(TestcontainerEx.Container.Config.t()) :: map()

Returns a human-readable map of a container's runtime state.

Useful for debugging from IEx or logging container details.

list_containers()

@spec list_containers() :: [String.t()]

Returns the list of tracked container IDs from the server state.

These are containers managed by the current TestcontainerEx session.

list_networks()

@spec list_networks() :: [String.t()]

Returns the list of tracked network names from the server state.

status()

@spec status() :: map()

Returns a summary of the TestcontainerEx server status.

Includes connection state, detected engine, host, and session ID.

summarize(container)

Returns a formatted string summary of a container for quick console inspection.