class

Testcontainers::RabbitmqContainer

Inherits Testcontainers::DockerContainer < Reference < Object

RabbitmqContainer provides a pre-configured container for RabbitMQ.

Example:

container = Testcontainers::RabbitmqContainer.new
container.start

url = container.connection_url
# => "amqp://guest:guest@localhost:32768"

container.stop
container.remove

Constants

RABBITMQ_DEFAULT_IMAGE = "rabbitmq:management"
RABBITMQ_DEFAULT_PASSWORD = "guest"
RABBITMQ_DEFAULT_PORT = 5672
RABBITMQ_DEFAULT_USERNAME = "guest"
RABBITMQ_DEFAULT_VHOST = "/"
RABBITMQ_MANAGEMENT_PORT = 15672

Constructors

new(image : String = RABBITMQ_DEFAULT_IMAGE, username : String = ENV.fetch("RABBITMQ_DEFAULT_USER", RABBITMQ_DEFAULT_USERNAME), password : String = ENV.fetch("RABBITMQ_DEFAULT_PASS", RABBITMQ_DEFAULT_PASSWORD), vhost : String = ENV.fetch("RABBITMQ_DEFAULT_VHOST", RABBITMQ_DEFAULT_VHOST))
Source

Instance methods

connection_url(protocol : String = "amqp", username : String | Nil = nil, password : String | Nil = nil, vhost : String | Nil = nil) : String

Returns the AMQP connection URL.

Source
management_port
Source
management_url

Returns the management UI URL.

Source
password
Source
port
Source
start

Starts the container.

This will:

  1. Pull the image if not present
  2. Create the container
  3. Start the container
  4. Execute the wait strategy (if any)

Returns self for method chaining.

Source
username
Source
vhost
Source
with_password(password : String) : self
Source
with_username(username : String) : self
Source
with_vhost(vhost : String) : self
Source