setup

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SeparatorV1 is the separator used in docker-compose v1
	// refer to https://github.com/docker/compose/blob/5becea4ca9f68875334c92f191a13482bcd6e5cf/compose/service.py#L1492-L1498
	SeparatorV1 = "_"
	// SeparatorV2 is the separator used in docker-compose v2
	// refer to https://github.com/docker/compose/blob/981aea674d052ee1ab252f71c3ca1f9f8a7e32de/pkg/compose/convergence.go#L252-L257
	SeparatorV2 = "-"
)
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 CloseLogFollower added in v1.1.0

func CloseLogFollower()

func ComposeSetup

func ComposeSetup(e2eConfig *config.E2EConfig) error

ComposeSetup sets up environment according to e2e.yaml.

func GetIdentity

func GetIdentity() string

func InitLogFollower added in v1.1.0

func InitLogFollower()

func KindCleanNotify added in v1.1.0

func KindCleanNotify()

KindCleanNotify notify when clean up

func KindSetup

func KindSetup(e2eConfig *config.E2EConfig) error

KindSetup sets up environment according to e2e.yaml.

func KindShouldWaitSignal added in v1.1.0

func KindShouldWaitSignal() bool

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, cluster *util.K8sClusterInfo) error

RunCommandsAndWait Concurrently run commands and wait for conditions.

func RunStepsAndWait

func RunStepsAndWait(steps []config.Step, waitTimeout time.Duration, 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 ComposeContainer added in v1.1.0

type ComposeContainer struct {
	Service *ComposeService
	ID      string
}

type ComposeContainerListener added in v1.1.0

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

func NewComposeContainerListener added in v1.1.0

func NewComposeContainerListener(ctx context.Context, cli *client.Client, services []*ComposeService) *ComposeContainerListener

func (*ComposeContainerListener) Listen added in v1.1.0

func (c *ComposeContainerListener) Listen(consumer func(container *ComposeContainer)) error

func (*ComposeContainerListener) Stop added in v1.1.0

func (c *ComposeContainerListener) Stop()

type ComposeService added in v1.1.0

type ComposeService struct {
	Name string
	// contains filtered or unexported fields
}

func (*ComposeService) FindContainer added in v1.2.0

func (c *ComposeService) FindContainer(cli *client.Client, identity string) (*types.Container, error)

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 KindContainerListener added in v1.1.0

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

KindContainerListener listen or get all kubernetes pod

func NewKindContainerListener added in v1.1.0

func NewKindContainerListener(ctx context.Context, clientGetter *util.K8sClusterInfo) *KindContainerListener

func (*KindContainerListener) GetAllPods added in v1.1.0

func (c *KindContainerListener) GetAllPods() ([]*v1.Pod, error)

func (*KindContainerListener) Listen added in v1.1.0

func (c *KindContainerListener) Listen(consumer func(pod *v1.Pod)) error

Listen pod event

func (*KindContainerListener) Stop added in v1.1.0

func (c *KindContainerListener) Stop()

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