Documentation ¶
Overview ¶
Package rabbitmq provides a Gnomock Preset for RabbitMQ.
Index ¶
Constants ¶
const ManagementPort = "management"
ManagementPort is a name of the port exposed by RabbitMQ management plugin. This port is only available when an appropriate version of RabbitMQ docker image is used. See `Preset` docs for more info.
Variables ¶
This section is empty.
Functions ¶
func Preset ¶
Preset creates a new Gmomock RabbitMQ preset. This preset includes a RabbitMQ specific healthcheck function and default RabbitMQ image and port.
By default, this preset does not use RabbitMQ Management plugin. To enable it, use one of the management tags with `WithVersion` option. Management port will be accessible using `container.Port(rabbitmq.ManagementPort)`. See https://hub.docker.com/_/rabbitmq/?tab=tags for a list of available tags.
When used without specifying username/password, default ones are used: guest/guest. Default version for this preset is 3.8.9.
Types ¶
type Message ¶ added in v0.10.0
type Message struct { Queue string `json:"queue"` ContentType string `json:"content_type"` StringBody string `json:"string_body"` Body []byte `json:"body"` }
Message is a single message sent to RabbitMQ.
type Option ¶
type Option func(*P)
Option is an optional configuration of this Gnomock preset. Use available Options to configure the container.
func WithMessages ¶ added in v0.10.0
WithMessages makes sure that these messages can be consumed during the test once the container is ready.
func WithMessagesFile ¶ added in v0.10.0
WithMessagesFile allows to load messages to be sent into RabbitMQ from one or multiple files.
func WithVersion ¶
WithVersion sets image version. See https://hub.docker.com/_/rabbitmq/?tab=tags for a list of available tags. Use ones with "management" to enable RabbitMQ management plugin, and get the mapped port using `container.Port(rabbitmq.ManagementPort)`.
type P ¶
type P struct { User string `json:"user"` Password string `json:"password"` Version string `json:"version"` Messages []Message `json:"messages"` MessagesFiles []string `json:"messages_files"` }
P is a Gnomock Preset implementation of RabbitMQ.
func (*P) Ports ¶
func (p *P) Ports() gnomock.NamedPorts
Ports returns ports that should be used to access this container.