dockertestutil

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDockertestCommandFailed  = errors.New("dockertest command failed")
	ErrDockertestCommandTimeout = errors.New("dockertest command timed out")
)
View Source
var ErrContainerNotFound = errors.New("container not found")

Functions

func AddContainerToNetwork

func AddContainerToNetwork(
	pool *dockertest.Pool,
	network *dockertest.Network,
	testContainer string,
) error

func DockerAllowLocalIPv6

func DockerAllowLocalIPv6(config *docker.HostConfig)

func DockerAllowNetworkAdministration

func DockerAllowNetworkAdministration(config *docker.HostConfig)

func DockerRestartPolicy

func DockerRestartPolicy(config *docker.HostConfig)

func ExecuteCommand

func ExecuteCommand(
	resource *dockertest.Resource,
	cmd []string,
	env []string,
	options ...ExecuteCommandOption,
) (string, string, error)

func GetFirstOrCreateNetwork

func GetFirstOrCreateNetwork(
	pool *dockertest.Pool,
	name string,
) (*dockertest.Network, error)

func IsRunningInContainer

func IsRunningInContainer() bool

func RandomFreeHostPort

func RandomFreeHostPort() (int, error)

RandomFreeHostPort asks the kernel for a free open port that is ready to use. (from https://github.com/phayes/freeport)

func SaveLog

func SaveLog(
	pool *dockertest.Pool,
	resource *dockertest.Resource,
	basePath string,
) error

Types

type ExecuteCommandConfig

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

type ExecuteCommandOption

type ExecuteCommandOption func(*ExecuteCommandConfig) error

func ExecuteCommandTimeout

func ExecuteCommandTimeout(timeout time.Duration) ExecuteCommandOption

Jump to

Keyboard shortcuts

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