mocks

package
v0.0.0-...-7f4d65f Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDockerClient

type MockDockerClient struct {
	Type                   string
	ImagePullFn            func(ctx context.Context, imageName string) error
	ContainerInspectFn     func(ctx context.Context, containerID string) (dockertypes.ContainerJSON, error)
	ContainerCreateFn      func(ctx context.Context, command []string, envvars []string, image string, binds []string, links []string, kernelCapabilities []string, pidMode string, containerName string) (dockercontainer.ContainerCreateCreatedBody, error)
	ImageExistsFn          func(ctx context.Context, imageName string) bool
	ContainerRemoveFn      func(ctx context.Context, containerID string, force bool) error
	ContainerStartFn       func(ctx context.Context, containerID string) error
	ContainerLogsFn        func(ctx context.Context, containerID string) (string, error)
	ContainerListFn        func(ctx context.Context) ([]string, error)
	ContainerExecCreateFn  func(ctx context.Context, containerID string, cmd []string, attachStdout bool, attachStderr bool) (dockertypes.IDResponse, error)
	ContainerExecStartFn   func(ctx context.Context, execID string) error
	ContainerExecAttachFn  func(ctx context.Context, execID string) (dockertypes.HijackedResponse, error)
	ContainerExecInspectFn func(ctx context.Context, execID string) (dockertypes.ContainerExecInspect, error)
	ImageInspectFn         func(ctx context.Context, imageName string) (dockertypes.ImageInspect, error)
	CopyFromContainerFn    func(ctx context.Context, container, srcPath string, followSymlink bool) (io.ReadCloser, dockertypes.ContainerPathStat, error)
	ContainerDiffFn        func(ctx context.Context, containerID string) ([]types.ChangedFile, error)
	HostIDFn               func(ctx context.Context) string
	ServerVersionFn        func(ctx context.Context) (dockertypes.Version, error)
}

MockDockerClient is a mock type implementing the dockeradapter.Client interface, by default all interface functions will raise a panic, you can however provide your own test specific function implementations which will take precedence. Refer to the dockerruntime_test.go file for examples

func (MockDockerClient) ContainerCreate

func (c MockDockerClient) ContainerCreate(ctx context.Context, command []string, envvars []string, image string, binds []string, links []string, kernelCapabilities []string, pidMode string, containerName string) (dockercontainer.ContainerCreateCreatedBody, error)

ContainerCreate is a mock implementation of dockeradapter.ContainerCreate

func (MockDockerClient) ContainerDiff

func (c MockDockerClient) ContainerDiff(ctx context.Context, containerID string) ([]types.ChangedFile, error)

ContainerDiff is a mock implementation of dockeradapter.ContainerDiff

func (*MockDockerClient) ContainerExecAttach

func (c *MockDockerClient) ContainerExecAttach(ctx context.Context, execID string) (dockertypes.HijackedResponse, error)

ContainerExecAttach is a mock implementation of dockeradapter.ContainerExecAttach

func (*MockDockerClient) ContainerExecCreate

func (c *MockDockerClient) ContainerExecCreate(ctx context.Context, containerID string, cmd []string, attachStdout bool, attachStderr bool) (dockertypes.IDResponse, error)

ContainerExecCreate is a mock implementation of dockeradapter.ContainerExecCreate

func (*MockDockerClient) ContainerExecInspect

func (c *MockDockerClient) ContainerExecInspect(ctx context.Context, execID string) (dockertypes.ContainerExecInspect, error)

ContainerExecInspect is a mock implementation of dockeradapter.ContainerExecInspect

func (*MockDockerClient) ContainerExecStart

func (c *MockDockerClient) ContainerExecStart(ctx context.Context, execID string) error

ContainerExecStart is a mock implementation of dockeradapter.ContainerExecStart

func (MockDockerClient) ContainerInspect

func (c MockDockerClient) ContainerInspect(ctx context.Context, containerID string) (dockertypes.ContainerJSON, error)

ContainerInspect is a mock implementation of dockeradapter.ContainerInspect

func (MockDockerClient) ContainerList

func (c MockDockerClient) ContainerList(ctx context.Context) ([]string, error)

ContainerList is a mock implementation of dockeradapter.ContainerList

func (MockDockerClient) ContainerLogs

func (c MockDockerClient) ContainerLogs(ctx context.Context, containerID string) (string, error)

ContainerLogs is a mock implementation of dockeradapter.ContainerLogs

func (MockDockerClient) ContainerRemove

func (c MockDockerClient) ContainerRemove(ctx context.Context, containerID string, force bool) error

ContainerRemove is a mock implementation of dockeradapter.ContainerRemove

func (MockDockerClient) ContainerStart

func (c MockDockerClient) ContainerStart(ctx context.Context, containerID string) error

ContainerStart is a mock implementation of dockeradapter.ContainerStart

func (MockDockerClient) CopyFromContainer

func (c MockDockerClient) CopyFromContainer(ctx context.Context, container, srcPath string, followSymlink bool) (io.ReadCloser, dockertypes.ContainerPathStat, error)

CopyFromContainer is a mock implementation of dockeradapter.CopyFromContainer

func (MockDockerClient) HostID

func (c MockDockerClient) HostID(ctx context.Context) string

HostID is a mock implementation of dockeradapter.HostID

func (MockDockerClient) ImageExists

func (c MockDockerClient) ImageExists(ctx context.Context, imageName string) bool

ImageExists is a mock implementation of dockeradapter.ImageExists

func (MockDockerClient) ImageInspect

func (c MockDockerClient) ImageInspect(ctx context.Context, imageName string) (dockertypes.ImageInspect, error)

ImageInspect is a mock implementation of dockeradapter.ImageInspect

func (MockDockerClient) ImagePull

func (c MockDockerClient) ImagePull(ctx context.Context, imageName string) error

ImagePull is a mock implementation of dockeradapter.ImagePull

func (MockDockerClient) ServerVersion

func (c MockDockerClient) ServerVersion(ctx context.Context) (dockertypes.Version, error)

ServerVersion is a mock implementation of dockeradapter.ServerVersion

type MockNetConn

type MockNetConn struct {
	ReadFn             func(b []byte) (n int, err error)
	WriteFn            func(b []byte) (n int, err error)
	CloseFn            func() error
	LocalAddrFn        func() net.Addr
	RemoteAddrFn       func() net.Addr
	SetDeadlineFn      func(t time.Time) error
	SetReadDeadlineFn  func(t time.Time) error
	SetWriteDeadlineFn func(t time.Time) error
}

MockNetConn TODO

func (MockNetConn) Close

func (c MockNetConn) Close() error

Close TODO

func (MockNetConn) LocalAddr

func (c MockNetConn) LocalAddr() net.Addr

LocalAddr TODO

func (MockNetConn) Read

func (c MockNetConn) Read(b []byte) (n int, err error)

Read TODO

func (MockNetConn) RemoteAddr

func (c MockNetConn) RemoteAddr() net.Addr

RemoteAddr TODO

func (MockNetConn) SetDeadline

func (c MockNetConn) SetDeadline(t time.Time) error

SetDeadline TODO

func (MockNetConn) SetReadDeadline

func (c MockNetConn) SetReadDeadline(t time.Time) error

SetReadDeadline TODO

func (MockNetConn) SetWriteDeadline

func (c MockNetConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline TODO

func (MockNetConn) Write

func (c MockNetConn) Write(b []byte) (n int, err error)

Write TODO

Jump to

Keyboard shortcuts

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