dockertest

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dockertest provides functionalities for mocking and faking the Docker API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// a placeholder for unimplemented methods.
	docker.CommonAPIClient
	// contains filtered or unexported fields
}

Client satisfies docker.CommonAPIClient for mocking.

func (*Client) ContainerInspect

func (c *Client) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)

ContainerInspect is the mock version of the actual method.

func (*Client) ContainerList

func (c *Client) ContainerList(ctx context.Context,
	options types.ContainerListOptions) ([]types.Container, error)

ContainerList is the mock version of the actual method.

func (*Client) ContainerRemove added in v0.3.0

func (c *Client) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error

ContainerRemove is the mock version of the actual method.

func (*Client) ContainerStop added in v0.3.0

func (c *Client) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error

ContainerStop is the mock version of the actual method.

func (*Client) Events added in v0.3.0

func (c *Client) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)

Events is the mock version of the actual method.

func (*Client) ImageBuild

func (c *Client) ImageBuild(ctx context.Context, context io.Reader,
	options types.ImageBuildOptions) (types.ImageBuildResponse, error)

ImageBuild is the mock version of the actual method.

func (*Client) Info

func (c *Client) Info(context.Context) (types.Info, error)

Info is the mock version of the actual method.

func (*Client) NegotiateAPIVersion

func (c *Client) NegotiateAPIVersion(ctx context.Context)

NegotiateAPIVersion is the mock version of the actual method.

func (*Client) NetworkCreate

func (c *Client) NetworkCreate(ctx context.Context, name string,
	options types.NetworkCreate) (types.NetworkCreateResponse, error)

NetworkCreate is the mock version of the actual method.

func (*Client) NetworkInspect

func (c *Client) NetworkInspect(ctx context.Context, network string,
	options types.NetworkInspectOptions) (types.NetworkResource, error)

NetworkInspect is the mock version of the actual method.

func (*Client) NetworkRemove

func (c *Client) NetworkRemove(ctx context.Context, network string) error

NetworkRemove is the mock version of the actual method.

func (*Client) ServiceCreate

ServiceCreate is the mock version of the actual method.

func (*Client) ServiceInspectWithRaw

func (c *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string,
	options types.ServiceInspectOptions) (swarm.Service, []byte, error)

ServiceInspectWithRaw is the mock version of the actual method.

func (*Client) ServiceList

func (c *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)

ServiceList is the mock version of the actual method.

func (*Client) ServiceLogs

func (c *Client) ServiceLogs(ctx context.Context,
	serviceID string, options types.ContainerLogsOptions) (io.ReadCloser, error)

ServiceLogs is the mock version of the actual method.

func (*Client) ServiceRemove

func (c *Client) ServiceRemove(ctx context.Context, serviceID string) error

ServiceRemove is the mock version of the actual method.

func (*Client) SwarmInit

func (c *Client) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)

SwarmInit is the mock version of the actual method.

func (*Client) TaskList

func (c *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)

TaskList is the mock version of the actual method.

type ContainerInspectRequest

type ContainerInspectRequest struct {
	Container string
}

ContainerInspectRequest holds call arguments of *Client.ContainerInspect.

type ContainerListRequest

type ContainerListRequest struct {
	Options types.ContainerListOptions
}

ContainerListRequest holds call arguments of *Client.ContainerList.

type ContainerRemoveRequest added in v0.3.0

type ContainerRemoveRequest struct {
	Container string
	Options   types.ContainerRemoveOptions
}

ContainerRemoveRequest holds call arguments of *Client.ContainerRemove.

type ContainerStopRequest added in v0.3.0

type ContainerStopRequest struct {
	Container string
}

ContainerStopRequest holds call arguments of *Client.ContainerStop.

type EventsRequest added in v0.3.0

type EventsRequest struct {
	Options types.EventsOptions
}

EventsRequest holds call arguments of *Client.Events.

type ImageBuildRequest

type ImageBuildRequest struct {
	FileData []byte
	Options  types.ImageBuildOptions
}

ImageBuildRequest holds call arguments of *Client.ImageBuild.

type InfoRequest

type InfoRequest struct {
}

InfoRequest holds call arguments of *Client.Info.

type NegotiateAPIVersionRequest

type NegotiateAPIVersionRequest struct {
}

NegotiateAPIVersionRequest holds call arguments of *Client.NegotiateAPIVersion.

type NetworkCreateRequest

type NetworkCreateRequest struct {
	Name    string
	Options types.NetworkCreate
}

NetworkCreateRequest holds call arguments of *Client.NetworkCreate.

type NetworkInspectRequest

type NetworkInspectRequest struct {
	Network string
	Options types.NetworkInspectOptions
}

NetworkInspectRequest holds call arguments of *Client.NetworkInspect.

type NetworkRemoveRequest

type NetworkRemoveRequest struct {
	Network string
}

NetworkRemoveRequest holds call arguments of *Client.NetworkRemove.

type NotFoundErr

type NotFoundErr struct{}

NotFoundErr satisfies docker client's notFound interface. docker.IsErrNotFound(err) will return true with NotFoundErr.

func (NotFoundErr) Error

func (e NotFoundErr) Error() string

Error returns the string representation of error.

func (NotFoundErr) NotFound

func (e NotFoundErr) NotFound() bool

NotFound indicates that this error is a not found error.

type ServiceCreateRequest

type ServiceCreateRequest struct {
	Service swarm.ServiceSpec
	Options types.ServiceCreateOptions
}

ServiceCreateRequest holds call arguments of *Client.ServiceCreate.

type ServiceInspectWithRawRequest

type ServiceInspectWithRawRequest struct {
	ServiceID string
	Options   types.ServiceInspectOptions
}

ServiceInspectWithRawRequest holds call arguments of *Client.ServiceInspectWithRaw.

type ServiceListRequest

type ServiceListRequest struct {
	Options types.ServiceListOptions
}

ServiceListRequest holds call arguments of *Client.ServiceList.

type ServiceLogsRequest

type ServiceLogsRequest struct {
	ServiceID string
	Options   types.ContainerLogsOptions
}

ServiceLogsRequest holds call arguments of *Client.ServiceLogs.

type ServiceRemoveRequest

type ServiceRemoveRequest struct {
	ServiceID string
}

ServiceRemoveRequest holds call arguments of *Client.ServiceRemove.

type SwarmInitRequest

type SwarmInitRequest struct {
	Request swarm.InitRequest
}

SwarmInitRequest holds call arguments of *Client.SwarmInit.

type TaskListRequest

type TaskListRequest struct {
	Options types.TaskListOptions
}

TaskListRequest holds call arguments of *Client.TaskList.

type Testing

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

Testing provides functionalities to fake Docker API calls and responses.

func New

func New() *Testing

New creates a new Testing.

func (*Testing) Client

func (t *Testing) Client() *Client

Client returns a new mock client compatible with Docker's docker.CommonAPIClient interface.

func (*Testing) LastContainerInspect

func (t *Testing) LastContainerInspect() <-chan ContainerInspectRequest

LastContainerInspect returns a channel that receives call arguments of last *Client.ContainerInspect call.

func (*Testing) LastContainerList

func (t *Testing) LastContainerList() <-chan ContainerListRequest

LastContainerList returns a channel that receives call arguments of last *Client.ContainerList call.

func (*Testing) LastContainerRemove added in v0.3.0

func (t *Testing) LastContainerRemove() <-chan ContainerRemoveRequest

LastContainerRemove returns a channel that receives call arguments of last *Client.ContainerRemove call.

func (*Testing) LastContainerStop added in v0.3.0

func (t *Testing) LastContainerStop() <-chan ContainerStopRequest

LastContainerStop returns a channel that receives call arguments of last *Client.ContainerStop call.

func (*Testing) LastEvents added in v0.3.0

func (t *Testing) LastEvents() <-chan EventsRequest

LastEvents returns a channel that receives call arguments of last *Client.ServiceLogs call.

func (*Testing) LastImageBuild

func (t *Testing) LastImageBuild() <-chan ImageBuildRequest

LastImageBuild returns a channel that receives call arguments of last *Client.ImageBuild call.

func (*Testing) LastInfo

func (t *Testing) LastInfo() <-chan InfoRequest

LastInfo returns a channel that receives call arguments of last *Client.Info call.

func (*Testing) LastNegotiateAPIVersion

func (t *Testing) LastNegotiateAPIVersion() <-chan NegotiateAPIVersionRequest

LastNegotiateAPIVersion returns a channel that receives call arguments of last *Client.NegotiateAPIVersion call.

func (*Testing) LastNetworkCreate

func (t *Testing) LastNetworkCreate() <-chan NetworkCreateRequest

LastNetworkCreate returns a channel that receives call arguments of last *Client.NetworkCreate call.

func (*Testing) LastNetworkInspect

func (t *Testing) LastNetworkInspect() <-chan NetworkInspectRequest

LastNetworkInspect returns a channel that receives call arguments of last *Client.NetworkInspect call.

func (*Testing) LastNetworkRemove

func (t *Testing) LastNetworkRemove() <-chan NetworkRemoveRequest

LastNetworkRemove returns a channel that receives call arguments of last *Client.NetworkRemove call.

func (*Testing) LastServiceCreate

func (t *Testing) LastServiceCreate() <-chan ServiceCreateRequest

LastServiceCreate returns a channel that receives call arguments of last *Client.ServiceCreate call.

func (*Testing) LastServiceInspectWithRaw

func (t *Testing) LastServiceInspectWithRaw() <-chan ServiceInspectWithRawRequest

LastServiceInspectWithRaw returns a channel that receives call arguments of last *Client.ServiceInspectWithRaw call.

func (*Testing) LastServiceList

func (t *Testing) LastServiceList() <-chan ServiceListRequest

LastServiceList returns a channel that receives call arguments of last *Client.ServiceList call.

func (*Testing) LastServiceLogs

func (t *Testing) LastServiceLogs() <-chan ServiceLogsRequest

LastServiceLogs returns a channel that receives call arguments of last *Client.ServiceLogs call.

func (*Testing) LastServiceRemove

func (t *Testing) LastServiceRemove() <-chan ServiceRemoveRequest

LastServiceRemove returns a channel that receives call arguments of last *Client.ServiceRemove call.

func (*Testing) LastSwarmInit

func (t *Testing) LastSwarmInit() <-chan SwarmInitRequest

LastSwarmInit returns a channel that receives call arguments of last *Client.SwarmInit call.

func (*Testing) LastTaskList

func (t *Testing) LastTaskList() <-chan TaskListRequest

LastTaskList returns a channel that receives call arguments of last *Client.TaskList call.

func (*Testing) ProvideContainerInspect

func (t *Testing) ProvideContainerInspect(json types.ContainerJSON, err error)

ProvideContainerInspect sets fake return values for the next call to *Client.ContainerInspect.

func (*Testing) ProvideContainerList

func (t *Testing) ProvideContainerList(containers []types.Container, err error)

ProvideContainerList sets fake return values for the next call to *Client.ContainerList.

func (*Testing) ProvideContainerRemove added in v0.3.0

func (t *Testing) ProvideContainerRemove(err error)

ProvideContainerRemove sets fake return values for the next call to *Client.ContainerInspect.

func (*Testing) ProvideContainerStop added in v0.3.0

func (t *Testing) ProvideContainerStop(err error)

ProvideContainerStop sets fake return values for the next call to *Client.ContainerInspect.

func (*Testing) ProvideEvents added in v0.3.0

func (t *Testing) ProvideEvents(message chan events.Message, err chan error)

ProvideEvents sets fake return values for the next call to *Client.Event.

func (*Testing) ProvideImageBuild

func (t *Testing) ProvideImageBuild(rc io.ReadCloser, err error)

ProvideImageBuild sets fake return values for the next call to *Client.ImageBuild.

func (*Testing) ProvideInfo

func (t *Testing) ProvideInfo(info types.Info, err error)

ProvideInfo sets fake return values for the next call to *Client.Into.

func (*Testing) ProvideNetworkCreate

func (t *Testing) ProvideNetworkCreate(response types.NetworkCreateResponse, err error)

ProvideNetworkCreate sets fake return values for the next call to *Client.NetworkCreate.

func (*Testing) ProvideNetworkInspect

func (t *Testing) ProvideNetworkInspect(resource types.NetworkResource, err error)

ProvideNetworkInspect sets fake return values for the next call to *Client.NetworkInspect.

func (*Testing) ProvideServiceCreate

func (t *Testing) ProvideServiceCreate(response types.ServiceCreateResponse, err error)

ProvideServiceCreate sets fake return values for the next call to *Client.ServiceCreate.

func (*Testing) ProvideServiceInspectWithRaw

func (t *Testing) ProvideServiceInspectWithRaw(service swarm.Service, data []byte, err error)

ProvideServiceInspectWithRaw sets fake return values for the next call to *Client.ServiceInspectWithRaw.

func (*Testing) ProvideServiceList

func (t *Testing) ProvideServiceList(services []swarm.Service, err error)

ProvideServiceList sets fake return values for the next call to *Client.ServiceList.

func (*Testing) ProvideServiceLogs

func (t *Testing) ProvideServiceLogs(rc io.ReadCloser, err error)

ProvideServiceLogs sets fake return values for the next call to *Client.ServiceLogs.

func (*Testing) ProvideServiceRemove

func (t *Testing) ProvideServiceRemove(err error)

ProvideServiceRemove sets fake return values for the next call to *Client.ServiceRemove.

func (*Testing) ProvideTaskList

func (t *Testing) ProvideTaskList(tasks []swarm.Task, err error)

ProvideTaskList sets fake return values for the next call to *Client.TaskList.

Jump to

Keyboard shortcuts

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