TestcontainerEx.EmqxContainer (testcontainer_ex v0.9.1)

Copy Markdown View Source

Provides functionality for creating and managing EMQX container configurations.

Summary

Functions

Retrieves the default Docker image for the Emqx container.

Returns the address on the host machine where the Emqx container is listening.

Returns the port on the host machine where the Emqx container is listening.

Creates a new EmqxContainer struct with default configurations.

Sets the check image regex (or string) used to validate the container image name before starting.

Overrides the default image used for the Emqx container.

Sets the container name.

Enables or disables container reuse.

Types

t()

@type t() :: %TestcontainerEx.EmqxContainer{
  check_image: term(),
  dashboard_port: term(),
  image: term(),
  mqtt_over_ws_port: term(),
  mqtt_over_wss_port: term(),
  mqtt_port: term(),
  mqtts_port: term(),
  name: term(),
  reuse: term(),
  wait_timeout: term()
}

Functions

default_image()

Retrieves the default Docker image for the Emqx container.

host()

Returns the address on the host machine where the Emqx container is listening.

mqtt_port(container)

Returns the port on the host machine where the Emqx container is listening.

new()

Creates a new EmqxContainer struct with default configurations.

with_check_image(config, check_image)

@spec with_check_image(t(), String.t() | Regex.t()) :: t()

Sets the check image regex (or string) used to validate the container image name before starting.

with_image(config, image)

Overrides the default image used for the Emqx container.

Examples

iex> config = EmqxContainer.new()
iex> new_config = EmqxContainer.with_image(config, "emqx:xyz")
iex> new_config.image
"emqx:xyz"

with_name(config, name)

@spec with_name(t(), String.t()) :: t()

Sets the container name.

with_ports(config, mqtt_port \\ 1883, mqtts_port \\ 8883, mqtt_over_ws_port \\ 8083, mqtt_over_wss_port \\ 8084, dashboard_port \\ 18083)

with_reuse(config, reuse)

@spec with_reuse(t(), boolean()) :: t()

Enables or disables container reuse.