test

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCmd

func ExecCmd(containerID string, cmd []string) (string, error)

func NewNetwork

func NewNetwork(name string) (testcontainers.Network, error)

NewNetwork creates a network.

func RandomSuffix

func RandomSuffix() string

Types

type BaseContainer

type BaseContainer struct {
	// contains filtered or unexported fields
}

BaseContainer provide the basic operations for a container.

func NewContainer

func NewContainer(image string) *BaseContainer

NewContainer creates a container using the image.

func (*BaseContainer) ExecCmd

func (bc *BaseContainer) ExecCmd(ctx context.Context, cmd []string) (int, error)

ExecCmd executes a command in the container.

func (*BaseContainer) ExposedPorts

func (bc *BaseContainer) ExposedPorts(ports []string) *BaseContainer

ExposedPorts exposes the ports from the container.

func (*BaseContainer) GetANetworkAlias

func (bc *BaseContainer) GetANetworkAlias(network string) string

GetANetworkAlias returns a network alias of the container.

func (*BaseContainer) GetContainerID

func (bc *BaseContainer) GetContainerID() string

GetContainerID gets the container ID.

func (*BaseContainer) MappedPort

func (bc *BaseContainer) MappedPort(ctx context.Context, port string) (nat.Port, error)

MappedPort gets the outside port.

func (*BaseContainer) Start

func (bc *BaseContainer) Start(ctx context.Context) error

Start starts the container.

func (*BaseContainer) Stop

func (bc *BaseContainer) Stop(ctx context.Context) error

Stop stops the container.

func (*BaseContainer) WaitForHTTPPath

func (bc *BaseContainer) WaitForHTTPPath(path string) *BaseContainer

WaitForHTTPPath waits for the path can be used. The Default access port is 80. TODO: support the specified path with a port.

func (*BaseContainer) WaitForLog

func (bc *BaseContainer) WaitForLog(log string) *BaseContainer

WaitForLog waits for the log string appear.

func (*BaseContainer) WaitForPort

func (bc *BaseContainer) WaitForPort(port string) *BaseContainer

WaitForPort waits for the container ports exposed.

func (*BaseContainer) WithCmd

func (bc *BaseContainer) WithCmd(cmd []string) *BaseContainer

WithCmd sets the containers start up commands.

func (*BaseContainer) WithEnv

func (bc *BaseContainer) WithEnv(env map[string]string) *BaseContainer

WithEnv sets the environment variable to the container.

func (*BaseContainer) WithNetwork

func (bc *BaseContainer) WithNetwork(network []string) *BaseContainer

WithNetwork uses a existent network for the container.

func (*BaseContainer) WithNetworkAliases

func (bc *BaseContainer) WithNetworkAliases(aliases map[string][]string) *BaseContainer

WithNetworkAliases creates some aliases for the container.

type Cluster

type Cluster interface {
	// Start a cluster.
	Start(ctx context.Context) error

	// Stop a cluster.
	Stop(ctx context.Context) error

	// GetPlainTextServiceURL gets the service connect string.
	GetPlainTextServiceURL(ctx context.Context) (string, error)

	// GetHTTPServiceURL gets the HTTP service connect string.
	GetHTTPServiceURL(ctx context.Context) (string, error)

	// Close closes the resources used for starting cluster.
	Close(ctx context.Context)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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