testenv

package
v0.25.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2017 License: MIT Imports: 11 Imported by: 0

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

View Source
const (
	RabbitMQ3_5     = "3.5-management"
	RabbitMQ3Latest = "3-management-alpine"
)

list of docker tags with rabbitmq versions

Variables

View Source
var MaxWait = 20 * time.Second

MaxWait is time before the docker setup will fail with timeout

Functions

func GetOrDie

func GetOrDie(url string, timeout time.Duration) string

GetOrDie fetches the url. Will log.Fatal on error/timeout.

func GetURL

func GetURL(url string, timeout time.Duration) (string, error)

GetURL fetches the url. Will return error.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL