View Source Testcontainers.CephContainer (testcontainers v1.12.0)

Provides functionality for creating and managing Ceph container configurations.

Summary

Functions

Generates the connection options for accessing the Ceph service running within the container. Compatible with what ex_aws expects in ExAws.request(options)

Generates the connection URL for accessing the Ceph service running within the container.

Retrieves the default Docker image used for the Ceph container.

Creates a new CephContainer struct with default attributes.

Retrieves the port mapped by the Docker host for the Ceph container.

Sets the access_key used for authentication with the Ceph container.

Sets the bucket that is automatically in the Ceph container.

Set the regular expression to check the image validity.

Sets the image of the Ceph container configuration.

Sets the port on which the Ceph container will be exposed.

Set the reuse flag to reuse the container if it is already running.

Sets the secret_key used for authentication with the Ceph container.

Sets the maximum time (in milliseconds) the system will wait for the Ceph container to be ready before timing out.

Functions

connection_opts(container)

Generates the connection options for accessing the Ceph service running within the container. Compatible with what ex_aws expects in ExAws.request(options)

connection_url(container)

Generates the connection URL for accessing the Ceph service running within the container.

This URL is based on the standard localhost IP and the mapped port for the container.

Parameters

  • container: The active Ceph container instance.

Examples

iex> CephContainer.connection_url(container)
"http://localhost:32768" # This value will be different depending on the mapped port.

default_image()

Retrieves the default Docker image used for the Ceph container.

Examples

iex> CephContainer.default_image()
"quay.io/ceph/demo"

new()

Creates a new CephContainer struct with default attributes.

port(container)

Retrieves the port mapped by the Docker host for the Ceph container.

Parameters

  • container: The active Ceph container instance.

Examples

iex> CephContainer.port(container)
32768 # This value will be different depending on the mapped port.

with_access_key(config, access_key)

Sets the access_key used for authentication with the Ceph container.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_access_key(config, "new_access_key")
iex> new_config.access_key
"new_access_key"

with_bucket(config, bucket)

Sets the bucket that is automatically in the Ceph container.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_bucket(config, "test_bucket")
iex> new_config.bucket
"test_bucket"

with_check_image(config, check_image)

Set the regular expression to check the image validity.

with_image(config, image)

Sets the image of the Ceph container configuration.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_image(config, "quay.io/ceph/alternative")
iex> new_config.image
"quay.io/ceph/alternative"

with_port(config, port)

Sets the port on which the Ceph container will be exposed.

Parameters

  • config: The current Ceph container configuration.
  • port: The target port number.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_port(config, 8081)
iex> new_config.port
8081

with_reuse(config, reuse)

Set the reuse flag to reuse the container if it is already running.

with_secret_key(config, secret_key)

Sets the secret_key used for authentication with the Ceph container.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_secret_key(config, "new_secret_key")
iex> new_config.secret_key
"new_secret_key"

with_wait_timeout(config, wait_timeout)

Sets the maximum time (in milliseconds) the system will wait for the Ceph container to be ready before timing out.

Parameters

  • config: The current Ceph container configuration.
  • wait_timeout: The time to wait in milliseconds.

Examples

iex> config = CephContainer.new()
iex> new_config = CephContainer.with_wait_timeout(config, 400_000)
iex> new_config.wait_timeout
400_000