dockertestwrapper

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPostgresPort     string = "5432/tcp"
	DefaultPostgresUser     string = "postgres"
	DefaultPostgresPassword string = "postgres"
	DefaultPostgresDatabase string = "postgres"
)

Default postgres connection details

View Source
const DefaultContainerExpiresAfterSeconds uint = 1800

DefaultContainerExpiresAfterSeconds tells docker the hard limit in seconds when the container should be purged

View Source
const PostgresImageName string = "postgres"

PostgresImageName is the image name of the postgres docker image

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterInitActionFunc

type AfterInitActionFunc func(hostname string, port int) error

AfterInitActionFunc is a function type which will be executed after container initialization

type WrapperInstance

type WrapperInstance struct {
	Hostname   string
	Port       int
	DockerHost string // deprecated
	HostPort   int    // deprecated
	Pool       *dockertest.Pool
	Resource   *dockertest.Resource
}

WrapperInstance holds all the information of the running container

func InitContainer

func InitContainer(params WrapperParams) (instance *WrapperInstance, err error)

InitContainer starts a new container with the given parameters

func InitPostgresContainer

func InitPostgresContainer(tag string) (*WrapperInstance, error)

InitPostgresContainer starts a postgres container with the given tag and the default credentials

func (WrapperInstance) PurgeContainer

func (w WrapperInstance) PurgeContainer() error

PurgeContainer purges the running container

type WrapperParams

type WrapperParams struct {
	ImageName           string
	ImageTag            string
	EnvVariables        []string
	ContainerPort       string
	AfterInitActionFunc AfterInitActionFunc
}

WrapperParams contains all parameters needed to start a new custom container

Jump to

Keyboard shortcuts

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