testcontainers_gleam/cassandra

Cassandra container configuration.

Wraps Testcontainers.CassandraContainer to provide typed builders for a Cassandra 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/cassandra

let config = cassandra.new()
let container = cassandra.build(config)
let assert Ok(running) = testcontainers_gleam.start_container(container)
let uri = cassandra.connection_uri(running)

Types

Configuration for a Cassandra container.

pub type CassandraConfig

Values

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

Build a Container from this Cassandra configuration.

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

Get the Cassandra connection URI (e.g. "cassandra://localhost:32768/").

pub fn default_image() -> String

Get the default Docker image name (without tag).

pub fn default_port() -> Int

Get the default exposed port (9042).

pub fn get_password() -> String

Get the default password ("cassandra").

pub fn get_username() -> String

Get the default username ("cassandra").

pub fn new() -> CassandraConfig

Create a new Cassandra container configuration with defaults.

Default image: cassandra:3.11.2, port: 9042, timeout: 60s, credentials: cassandra/cassandra.

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

Get the host-mapped port for the Cassandra container.

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

Set the regex pattern to validate the image name.

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

Override the Docker image.

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

Enable or disable container reuse across test runs.

Search Document