testcontainers_gleam/redis

Redis container configuration.

Wraps Testcontainers.RedisContainer to provide typed builders for a Redis container. Use new to create a default configuration, customize with with_* functions, then build to get a Container.

Example

import testcontainers_gleam
import testcontainers_gleam/redis

let config = redis.new()
let container = redis.build(config)
let assert Ok(running) = testcontainers_gleam.start_container(container)
let url = redis.connection_url(running)

Types

Configuration for a Redis container.

pub type RedisConfig

Values

pub fn build(config: RedisConfig) -> container.Container

Build a Container from this Redis configuration.

pub fn connection_url(container: container.Container) -> String

Get the Redis connection URL (e.g. "redis://localhost:32768/").

pub fn default_image() -> String

Get the default Docker image name (without tag).

pub fn new() -> RedisConfig

Create a new Redis container configuration with defaults.

Default image: redis:7.2-alpine, port: 6379, timeout: 60s.

pub fn port(container: container.Container) -> Int

Get the host-mapped port for the Redis container.

pub fn with_check_image(
  config: RedisConfig,
  pattern: String,
) -> RedisConfig

Set the regex pattern to validate the image name.

pub fn with_image(
  config: RedisConfig,
  image: String,
) -> RedisConfig

Override the Docker image.

pub fn with_port(config: RedisConfig, port: Int) -> RedisConfig

Override the exposed port (default 6379).

pub fn with_reuse(
  config: RedisConfig,
  reuse: Bool,
) -> RedisConfig

Enable or disable container reuse across test runs.

pub fn with_wait_timeout(
  config: RedisConfig,
  timeout: Int,
) -> RedisConfig

Override the wait timeout in milliseconds (default 60000).

Search Document