Documentation ¶
Overview ¶
Package testenv provides a rabbitmq test environment in docker for a full set of integration tests. Some usefull helper functions for rabbitmq interaction are included as well
Index ¶
Constants ¶
const ( RabbitMQ3_5 = "3.5-management" RabbitMQ3Latest = "3-management-alpine" )
list of docker tags with rabbitmq versions
Variables ¶
var MaxWait = 20 * time.Second
MaxWait is time before the docker setup will fail with timeout
Functions ¶
Types ¶
type TestEnvironment ¶
type TestEnvironment struct { Rabbit rabbit // contains filtered or unexported fields }
TestEnvironment contains all necessars
func NewEnvironment ¶
func NewEnvironment(t *testing.T, dockerTag string) TestEnvironment
NewEnvironment sets up a new environment. It will nlog fatal if something goes wrong
func (*TestEnvironment) AmqpURL ¶
func (tenv *TestEnvironment) AmqpURL(withCred bool) string
AmqpURL returns the url to the rabbitmq server e.g. amqp://localhost:5672
func (*TestEnvironment) CleanUp ¶
func (tenv *TestEnvironment) CleanUp()
CleanUp removes the container. If not called the container will run forever
func (*TestEnvironment) ManagementURL ¶
func (tenv *TestEnvironment) ManagementURL() string
ManagementURL returns the full http url including username/password to the management api in the docker environment. e.g. http://guest:guest@localhost:15672
func (*TestEnvironment) MustSetPolicy ¶
func (tenv *TestEnvironment) MustSetPolicy(name string, pattern string)
MustSetPolicy adds a policy "name" to the default vhost. On error it will log.Fatal