setup

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bridge        = "bridge"         // Bridge network name (as well as driver)
	ReaperDefault = "reaper_default" // Default network name when bridge is not available

	TestcontainerLabel = "org.testcontainers.golang"
)

Variables

This section is empty.

Functions

func ComposeSetup

func ComposeSetup(e2eConfig *config.E2EConfig) error

ComposeSetup sets up environment according to e2e.yaml.

func GetIdentity

func GetIdentity() string

func KindSetup

func KindSetup(e2eConfig *config.E2EConfig) error

KindSetup sets up environment according to e2e.yaml.

func NewTimeout

func NewTimeout(timeBefore time.Time, timeout time.Duration) time.Duration

NewTimeout calculates new timeout since timeBefore.

func RunCommandsAndWait

func RunCommandsAndWait(run config.Run, timeout time.Duration) error

RunCommandsAndWait Concurrently run commands and wait for conditions.

func RunStepsAndWait

func RunStepsAndWait(steps []config.Step, timeout int, k8sCluster *util.K8sClusterInfo) error

func WaitPort

func WaitPort(ctx context.Context, target wait.StrategyTarget, waitPort nat.Port, timeout time.Duration) (err error)

WaitUntilReady implements Strategy.WaitUntilReady

Types

type DockerContainer

type DockerContainer struct {
	// Container ID from Docker
	ID         string
	WaitingFor wait.Strategy
	Image      string
	// contains filtered or unexported fields
}

DockerContainer represents a container started using Docker

func (*DockerContainer) ContainerIP

func (c *DockerContainer) ContainerIP(ctx context.Context) (string, error)

ContainerIP gets the IP address of the primary network within the container.

func (*DockerContainer) Endpoint

func (c *DockerContainer) Endpoint(ctx context.Context, proto string) (string, error)

Endpoint gets proto://host:port string for the first exposed port Will returns just host:port if proto is ""

func (*DockerContainer) Exec

func (c *DockerContainer) Exec(ctx context.Context, cmd []string) (int, error)

func (*DockerContainer) FollowOutput

func (c *DockerContainer) FollowOutput(consumer LogConsumer)

FollowOutput adds a LogConsumer to be sent logs from the container's STDOUT and STDERR

func (*DockerContainer) GetContainerID

func (c *DockerContainer) GetContainerID() string

func (*DockerContainer) Host

func (c *DockerContainer) Host(ctx context.Context) (string, error)

Host gets host (ip or name) of the docker daemon where the container port is exposed Warning: this is based on your Docker host setting. Will fail if using an SSH tunnel You can use the "TC_HOST" env variable to set this yourself

func (*DockerContainer) Logs

Logs will fetch both STDOUT and STDERR from the current container. Returns a ReadCloser and leaves it up to the caller to extract what it wants.

func (*DockerContainer) MappedPort

func (c *DockerContainer) MappedPort(ctx context.Context, port nat.Port) (nat.Port, error)

MappedPort gets externally mapped port for a container port

func (*DockerContainer) Name

func (c *DockerContainer) Name(ctx context.Context) (string, error)

Name gets the name of the container.

func (*DockerContainer) NetworkAliases

func (c *DockerContainer) NetworkAliases(ctx context.Context) (map[string][]string, error)

NetworkAliases gets the aliases of the container for the networks it is attached to.

func (*DockerContainer) Networks

func (c *DockerContainer) Networks(ctx context.Context) ([]string, error)

Networks gets the names of the networks the container is attached to.

func (*DockerContainer) PortEndpoint

func (c *DockerContainer) PortEndpoint(ctx context.Context, port nat.Port, proto string) (string, error)

PortEndpoint gets proto://host:port string for the given exposed port Will returns just host:port if proto is ""

func (*DockerContainer) Ports

func (c *DockerContainer) Ports(ctx context.Context) (nat.PortMap, error)

Ports gets the exposed ports for the container.

type DockerNetwork

type DockerNetwork struct {
	ID     string // Network ID from Docker
	Driver string
	Name   string
}

DockerNetwork represents a network started using Docker

type DockerProvider

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

DockerProvider implements the ContainerProvider interface

func (*DockerProvider) GetGatewayIP

func (p *DockerProvider) GetGatewayIP(ctx context.Context) (string, error)

func (*DockerProvider) GetNetwork

GetNetwork returns the object representing the network identified by its name

type Log

type Log struct {
	LogType string
	Content []byte
}

type LogConsumer

type LogConsumer interface {
	Accept(Log)
}

type Network

type Network interface {
	Remove(context.Context) error // removes the network
}

type NetworkRequest

type NetworkRequest struct {
	Driver         string
	CheckDuplicate bool
	Internal       bool
	EnableIPv6     bool
	Name           string
	Labels         map[string]string
	Attachable     bool

	ReaperImage string // alternative reaper registry
}

NetworkRequest represents the parameters used to get a network

Jump to

Keyboard shortcuts

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