dockertest

package
v0.0.0-...-e3dcd6b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerDBConnection

func ContainerDBConnection(container *docker.Container, port docker.Port) (*sql.DB, error)

func CreateNetwork

func CreateNetwork(dockerClient *docker.Client, name string) (*docker.Network, error)

func FetchContainerFileContents

func FetchContainerFileContents(dockerClient *docker.Client, container *docker.Container, filePath string) (string, error)

func HostPort

func HostPort(containerPort docker.Port, container *docker.Container) string

func PullImage

func PullImage(dockerClient *docker.Client, repository string) error

func RemoveContainer

func RemoveContainer(dockerClient *docker.Client, container *docker.Container) error

func RemoveNetwork

func RemoveNetwork(dockerClient *docker.Client, network *docker.Network) error

func RunContainer

func RunContainer(dockerClient *docker.Client, containerName string, options ...ContainerOption) (*docker.Container, error)

Types

type ContainerOption

type ContainerOption func(*docker.CreateContainerOptions)

func AddBinds

func AddBinds(binds ...string) ContainerOption

func AddEnvVars

func AddEnvVars(envVars ...string) ContainerOption

func AddExposedPorts

func AddExposedPorts(ports ...docker.Port) ContainerOption

func WithCmd

func WithCmd(cmd ...string) ContainerOption

func WithEntrypoint

func WithEntrypoint(cmd string) ContainerOption

func WithImage

func WithImage(imageID string) ContainerOption

func WithNetwork

func WithNetwork(network *docker.Network) ContainerOption

func WithUser

func WithUser(username string) ContainerOption

type ExecResult

type ExecResult struct {
	ExitCode int
	Stdout   string
	Stderr   string
}

func HardKillMySQL

func HardKillMySQL(dockerClient *docker.Client, container *docker.Container) (*ExecResult, error)

func RunExec

func RunExec(dockerClient *docker.Client, exec *docker.Exec) (*ExecResult, error)

Jump to

Keyboard shortcuts

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