testcontainer_formulas/rabbitmq

RabbitMQ formula. Defaults to rabbitmq:3-management with guest creds.

use mq <- testcontainer.with_formula(
  rabbitmq.new()
  |> rabbitmq.with_username("app")
  |> rabbitmq.with_password("secret")
  |> rabbitmq.formula(),
)

// mq.amqp_url, mq.management_url, mq.host, mq.amqp_port

Types

RabbitMQ-specific configuration. Build with new/0 + with_*.

pub opaque type RabbitMqConfig

Typed output handed to the body of testcontainer.with_formula/2.

pub type RabbitMqContainer {
  RabbitMqContainer(
    container: container.Container,
    amqp_url: String,
    management_url: String,
    host: String,
    amqp_port: Int,
    management_port: Int,
    username: String,
    vhost: String,
  )
}

Constructors

  • RabbitMqContainer(
      container: container.Container,
      amqp_url: String,
      management_url: String,
      host: String,
      amqp_port: Int,
      management_port: Int,
      username: String,
      vhost: String,
    )

Values

pub fn formula(
  c: RabbitMqConfig,
) -> formula.Formula(RabbitMqContainer)

Builds the Formula(RabbitMqContainer) ready to pass to testcontainer.with_formula/2.

pub fn new() -> RabbitMqConfig

Sensible defaults: rabbitmq:3-management / guest / guest / /.

pub fn on_network_name(
  c: RabbitMqConfig,
  net: String,
) -> RabbitMqConfig

Same as on_network/2 when you already have the Docker network name.

pub fn with_extra_wait(
  c: RabbitMqConfig,
  s: wait.WaitStrategy,
) -> RabbitMqConfig

Adds an extra wait strategy on top of the default all_of([port(5672), log("Server startup complete")]).

pub fn with_image(
  c: RabbitMqConfig,
  image: String,
) -> RabbitMqConfig

Replaces the image entirely.

pub fn with_name(c: RabbitMqConfig, n: String) -> RabbitMqConfig
pub fn with_password(
  c: RabbitMqConfig,
  pass: String,
) -> RabbitMqConfig
pub fn with_secret_password(
  c: RabbitMqConfig,
  pass: cowl.Secret(String),
) -> RabbitMqConfig
pub fn with_username(
  c: RabbitMqConfig,
  user: String,
) -> RabbitMqConfig
pub fn with_version(
  c: RabbitMqConfig,
  version: String,
) -> RabbitMqConfig

Shorthand for rabbitmq:<version> (for example 3.13-management).

pub fn with_vhost(
  c: RabbitMqConfig,
  vhost: String,
) -> RabbitMqConfig

Sets the default vhost used by RabbitMQ bootstrap.

Search Document