Documentation ¶
Overview ¶
Package dockertest provides functionalities for mocking and faking the Docker API.
Index ¶
- type Client
- func (c *Client) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
- func (c *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (c *Client) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
- func (c *Client) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error
- func (c *Client) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
- func (c *Client) ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (c *Client) Info(context.Context) (types.Info, error)
- func (c *Client) NegotiateAPIVersion(ctx context.Context)
- func (c *Client) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
- func (c *Client) NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error)
- func (c *Client) NetworkRemove(ctx context.Context, network string) error
- func (c *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, ...) (types.ServiceCreateResponse, error)
- func (c *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
- func (c *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
- func (c *Client) ServiceRemove(ctx context.Context, serviceID string) error
- func (c *Client) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)
- func (c *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
- type ContainerInspectRequest
- type ContainerListRequest
- type ContainerRemoveRequest
- type ContainerStopRequest
- type EventsRequest
- type ImageBuildRequest
- type InfoRequest
- type NegotiateAPIVersionRequest
- type NetworkCreateRequest
- type NetworkInspectRequest
- type NetworkRemoveRequest
- type NotFoundErr
- type ServiceCreateRequest
- type ServiceInspectWithRawRequest
- type ServiceListRequest
- type ServiceRemoveRequest
- type SwarmInitRequest
- type TaskListRequest
- type Testing
- func (t *Testing) Client() *Client
- func (t *Testing) LastContainerInspect() <-chan ContainerInspectRequest
- func (t *Testing) LastContainerList() <-chan ContainerListRequest
- func (t *Testing) LastContainerRemove() <-chan ContainerRemoveRequest
- func (t *Testing) LastContainerStop() <-chan ContainerStopRequest
- func (t *Testing) LastEvents() <-chan EventsRequest
- func (t *Testing) LastImageBuild() <-chan ImageBuildRequest
- func (t *Testing) LastInfo() <-chan InfoRequest
- func (t *Testing) LastNegotiateAPIVersion() <-chan NegotiateAPIVersionRequest
- func (t *Testing) LastNetworkCreate() <-chan NetworkCreateRequest
- func (t *Testing) LastNetworkInspect() <-chan NetworkInspectRequest
- func (t *Testing) LastNetworkRemove() <-chan NetworkRemoveRequest
- func (t *Testing) LastServiceCreate() <-chan ServiceCreateRequest
- func (t *Testing) LastServiceInspectWithRaw() <-chan ServiceInspectWithRawRequest
- func (t *Testing) LastServiceList() <-chan ServiceListRequest
- func (t *Testing) LastServiceRemove() <-chan ServiceRemoveRequest
- func (t *Testing) LastSwarmInit() <-chan SwarmInitRequest
- func (t *Testing) LastTaskList() <-chan TaskListRequest
- func (t *Testing) ProvideContainerInspect(json types.ContainerJSON, err error)
- func (t *Testing) ProvideContainerList(containers []types.Container, err error)
- func (t *Testing) ProvideContainerRemove(err error)
- func (t *Testing) ProvideContainerStop(err error)
- func (t *Testing) ProvideEvents(message chan events.Message, err chan error)
- func (t *Testing) ProvideImageBuild(rc io.ReadCloser, err error)
- func (t *Testing) ProvideInfo(info types.Info, err error)
- func (t *Testing) ProvideNetworkCreate(response types.NetworkCreateResponse, err error)
- func (t *Testing) ProvideNetworkInspect(resource types.NetworkResource, err error)
- func (t *Testing) ProvideServiceCreate(response types.ServiceCreateResponse, err error)
- func (t *Testing) ProvideServiceInspectWithRaw(service swarm.Service, data []byte, err error)
- func (t *Testing) ProvideServiceList(services []swarm.Service, err error)
- func (t *Testing) ProvideServiceRemove(err error)
- func (t *Testing) ProvideTaskList(tasks []swarm.Task, err error)
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
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) NegotiateAPIVersion ¶
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 ¶
NetworkRemove is the mock version of the actual method.
func (*Client) ServiceCreate ¶
func (c *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (types.ServiceCreateResponse, error)
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) ServiceRemove ¶
ServiceRemove 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 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 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 (*Testing) 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) 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 ¶
ProvideContainerList sets fake return values for the next call to *Client.ContainerList.
func (*Testing) ProvideContainerRemove ¶ added in v0.3.0
ProvideContainerRemove sets fake return values for the next call to *Client.ContainerInspect.
func (*Testing) ProvideContainerStop ¶ added in v0.3.0
ProvideContainerStop sets fake return values for the next call to *Client.ContainerInspect.
func (*Testing) ProvideEvents ¶ added in v0.3.0
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 ¶
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 ¶
ProvideServiceInspectWithRaw sets fake return values for the next call to *Client.ServiceInspectWithRaw.
func (*Testing) ProvideServiceList ¶
ProvideServiceList sets fake return values for the next call to *Client.ServiceList.
func (*Testing) ProvideServiceRemove ¶
ProvideServiceRemove sets fake return values for the next call to *Client.ServiceRemove.