mix testcontainer_ex.test (testcontainer_ex v0.7.0)

Copy Markdown View Source

Runs Docker-dependent tests with automatic Ryuk setup and teardown.

This task handles the full lifecycle:

  1. Ensures Docker is available (starts Colima if needed)
  2. Starts a Ryuk reaper container for automatic test container cleanup
  3. Runs the requested tests (including :needs_dock tests)
  4. Stops Ryuk and cleans up on completion

Usage

# Run all tests including Docker-dependent ones
mix testcontainer_ex.test

# Run only Docker-dependent tests
mix testcontainer_ex.test --only needs_dock

# Run a specific test file
mix testcontainer_ex.test test/container/postgres_container_test.exs

# Run with a specific tag
mix testcontainer_ex.test --include needs_dock --exclude dood_limitation

# Only set up Ryuk (don't run tests)
mix testcontainer_ex.test --setup-only

# Tear down Ryuk and clean up
mix testcontainer_ex.test --teardown

Options

--setup-only    Start Ryuk and exit (don't run tests)
--teardown      Stop Ryuk and clean up test containers
--only TAG      Run only tests with this tag (can be repeated)
--include TAG   Include tests with this tag (passed to mix test)
--exclude TAG   Exclude tests with this tag (passed to mix test)

Environment variables

RYUK_IMAGE      Ryuk image (default: testcontainers/ryuk:0.14.0)
RYUK_PORT       Host port for Ryuk (default: auto)
TEST_TIMEOUT    Timeout in ms (default: 300000)