dockerutils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package dockerutils is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

func (*Container) AddEnv

func (c *Container) AddEnv(key, value string)

adds and environment variable with KEY and VALUE to container

func (*Container) Env

func (c *Container) Env() []string

returns a list of KEY=VALUE environment variable bindings for the container

func (*Container) RemoveEnv

func (c *Container) RemoveEnv(key string)

removes environment variable with KEY if it exists in container

type DockerUtils

type DockerUtils interface {
	Close() error
	CreateContainer(image string) (*Container, error)
	Exec(c *Container, cmd string) (stdout, stderr string, exitcode int, err error)
	CopyTo(c *Container, srcPath, dstPath string) error
	CopyFrom(c *Container, srcPath, dstPath string) error
	CopyBetweenContainers(srcContainer, destContainer *Container, srcPath, dstPath string) error
}

type DockerUtilsImpl added in v0.4.0

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

func New

func New(ctx context.Context, logger *slog.Logger) (*DockerUtilsImpl, error)

initializes a DockerUtils client - make sure to defer a call to Close() the client on exit

func NewWithClient

func NewWithClient(logger *slog.Logger, cli wrapper.DockerClient) *DockerUtilsImpl

initialize a DockerUtils client while providing a pre-created Docker client

func (*DockerUtilsImpl) Close added in v0.4.0

func (du *DockerUtilsImpl) Close() error

closes the DockerUtils client, and removes all containers created by the client during program execution

func (*DockerUtilsImpl) CopyBetweenContainers added in v0.4.0

func (du *DockerUtilsImpl) CopyBetweenContainers(srcContainer, destContainer *Container, srcPath, dstPath string) error

copies a file or directory between two containers

func (*DockerUtilsImpl) CopyFrom added in v0.4.0

func (du *DockerUtilsImpl) CopyFrom(c *Container, srcPath, dstPath string) error

copies a file or directory from a container to the host

func (*DockerUtilsImpl) CopyTo added in v0.4.0

func (du *DockerUtilsImpl) CopyTo(c *Container, srcPath, dstPath string) error

copies a file or directory from the host to a container

func (*DockerUtilsImpl) CreateContainer added in v0.4.0

func (du *DockerUtilsImpl) CreateContainer(image string) (*Container, error)

creates a container with the specified image

func (*DockerUtilsImpl) Exec added in v0.4.0

func (du *DockerUtilsImpl) Exec(c *Container, cmd string) (stdout, stderr string, exitcode int, err error)

executes the specified command on the provided container. Note: command will be executed with `sh -c <command>`

type MockDockerUtils added in v0.4.0

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

MockDockerUtils is a mock of DockerUtils interface.

func NewMockDockerUtils added in v0.4.0

func NewMockDockerUtils(ctrl *gomock.Controller) *MockDockerUtils

NewMockDockerUtils creates a new mock instance.

func (*MockDockerUtils) Close added in v0.4.0

func (m *MockDockerUtils) Close() error

Close mocks base method.

func (*MockDockerUtils) CopyBetweenContainers added in v0.4.0

func (m *MockDockerUtils) CopyBetweenContainers(srcContainer, destContainer *Container, srcPath, dstPath string) error

CopyBetweenContainers mocks base method.

func (*MockDockerUtils) CopyFrom added in v0.4.0

func (m *MockDockerUtils) CopyFrom(c *Container, srcPath, dstPath string) error

CopyFrom mocks base method.

func (*MockDockerUtils) CopyTo added in v0.4.0

func (m *MockDockerUtils) CopyTo(c *Container, srcPath, dstPath string) error

CopyTo mocks base method.

func (*MockDockerUtils) CreateContainer added in v0.4.0

func (m *MockDockerUtils) CreateContainer(image string) (*Container, error)

CreateContainer mocks base method.

func (*MockDockerUtils) EXPECT added in v0.4.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDockerUtils) Exec added in v0.4.0

func (m *MockDockerUtils) Exec(c *Container, cmd string) (string, string, int, error)

Exec mocks base method.

type MockDockerUtilsMockRecorder added in v0.4.0

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

MockDockerUtilsMockRecorder is the mock recorder for MockDockerUtils.

func (*MockDockerUtilsMockRecorder) Close added in v0.4.0

Close indicates an expected call of Close.

func (*MockDockerUtilsMockRecorder) CopyBetweenContainers added in v0.4.0

func (mr *MockDockerUtilsMockRecorder) CopyBetweenContainers(srcContainer, destContainer, srcPath, dstPath any) *gomock.Call

CopyBetweenContainers indicates an expected call of CopyBetweenContainers.

func (*MockDockerUtilsMockRecorder) CopyFrom added in v0.4.0

func (mr *MockDockerUtilsMockRecorder) CopyFrom(c, srcPath, dstPath any) *gomock.Call

CopyFrom indicates an expected call of CopyFrom.

func (*MockDockerUtilsMockRecorder) CopyTo added in v0.4.0

func (mr *MockDockerUtilsMockRecorder) CopyTo(c, srcPath, dstPath any) *gomock.Call

CopyTo indicates an expected call of CopyTo.

func (*MockDockerUtilsMockRecorder) CreateContainer added in v0.4.0

func (mr *MockDockerUtilsMockRecorder) CreateContainer(image any) *gomock.Call

CreateContainer indicates an expected call of CreateContainer.

func (*MockDockerUtilsMockRecorder) Exec added in v0.4.0

func (mr *MockDockerUtilsMockRecorder) Exec(c, cmd any) *gomock.Call

Exec indicates an expected call of Exec.

Jump to

Keyboard shortcuts

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