TestcontainerEx.Ryuk (testcontainer_ex v0.1.0)

Copy Markdown View Source

Manages the Ryuk reaper container for automatic cleanup of test containers.

Ryuk is a sidecar container that watches for labeled containers and removes them when the test process exits. It is started during GenServer init and registered with a filter matching the current session.

Summary

Functions

Returns whether Ryuk should run in privileged mode.

Starts the Ryuk reaper and registers the session filter.

Functions

privileged?(properties)

@spec privileged?(map()) :: boolean()

Returns whether Ryuk should run in privileged mode.

Checks TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED env var first, then ryuk.container.privileged property. Values "true" and "1" are truthy. The env var takes precedence.

start(conn, session_id, properties, docker_host, docker_hostname)

@spec start(Tesla.Env.client(), String.t(), map(), String.t(), String.t()) ::
  {:ok} | {:error, term()}

Starts the Ryuk reaper and registers the session filter.

Returns {:ok} on success or {:error, reason} on failure. Ryuk failures are non-fatal — tests can still run without auto-cleanup.