Documentation
¶
Overview ¶
Package fake is the test double for dockerruntime.Runtime: a typed recorder. Every call lands in Calls with its arguments, so tests assert on structs (image, env, labels, stop timeout) instead of substring-matching shell strings — the pattern replacing the sshexec-era command-string assertions.
Behavior is scripted per method through the *Fn fields. A nil Fn on a method that only returns an error succeeds silently (the common case for mutations); a nil Fn on a method that returns a value panics, so a test exercising a read path must say what the daemon would answer.
Index ¶
- type Call
- type Runtime
- func (f *Runtime) CallNames() []string
- func (f *Runtime) Calls() []Call
- func (f *Runtime) Close() error
- func (f *Runtime) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.CreateResponse, error)
- func (f *Runtime) ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
- func (f *Runtime) ContainerExecCreate(ctx context.Context, name string, options container.ExecOptions) (container.ExecCreateResponse, error)
- func (f *Runtime) ContainerExecInspect(ctx context.Context, execID string) (container.ExecInspect, error)
- func (f *Runtime) ContainerExecResize(ctx context.Context, execID string, options container.ResizeOptions) error
- func (f *Runtime) ContainerExecStart(ctx context.Context, execID string, options container.ExecStartOptions) error
- func (f *Runtime) ContainerInspect(ctx context.Context, name string) (container.InspectResponse, error)
- func (f *Runtime) ContainerList(ctx context.Context, options container.ListOptions) ([]container.Summary, error)
- func (f *Runtime) ContainerLogs(ctx context.Context, name string, options container.LogsOptions) (io.ReadCloser, error)
- func (f *Runtime) ContainerRemove(ctx context.Context, name string, options container.RemoveOptions) error
- func (f *Runtime) ContainerRename(ctx context.Context, name, newName string) error
- func (f *Runtime) ContainerRestart(ctx context.Context, name string, options container.StopOptions) error
- func (f *Runtime) ContainerStart(ctx context.Context, name string, options container.StartOptions) error
- func (f *Runtime) ContainerStats(ctx context.Context, name string, stream bool) (container.StatsResponseReader, error)
- func (f *Runtime) ContainerStop(ctx context.Context, name string, options container.StopOptions) error
- func (f *Runtime) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
- func (f *Runtime) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (container.PruneReport, error)
- func (f *Runtime) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
- func (f *Runtime) Events(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error)
- func (f *Runtime) ImageInspect(ctx context.Context, img string, options ...client.ImageInspectOption) (image.InspectResponse, error)
- func (f *Runtime) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
- func (f *Runtime) ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
- func (f *Runtime) ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
- func (f *Runtime) ImageRemove(ctx context.Context, img string, options image.RemoveOptions) ([]image.DeleteResponse, error)
- func (f *Runtime) ImageTag(ctx context.Context, img, ref string) error
- func (f *Runtime) ImagesPrune(ctx context.Context, pruneFilter filters.Args) (image.PruneReport, error)
- func (f *Runtime) Info(ctx context.Context) (system.Info, error)
- func (f *Runtime) NetworkConnect(ctx context.Context, networkID, name string, config *network.EndpointSettings) error
- func (f *Runtime) NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
- func (f *Runtime) NetworkDisconnect(ctx context.Context, networkID, name string, force bool) error
- func (f *Runtime) NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error)
- func (f *Runtime) NetworkList(ctx context.Context, options network.ListOptions) ([]network.Summary, error)
- func (f *Runtime) NetworkRemove(ctx context.Context, networkID string) error
- func (f *Runtime) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error)
- func (f *Runtime) Ping(ctx context.Context) (types.Ping, error)
- func (f *Runtime) RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error)
- func (f *Runtime) ServerVersion(ctx context.Context) (types.Version, error)
- func (f *Runtime) VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
- func (f *Runtime) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)
- func (f *Runtime) VolumeList(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error)
- func (f *Runtime) VolumeRemove(ctx context.Context, volumeID string, force bool) error
- func (f *Runtime) VolumesPrune(ctx context.Context, pruneFilter filters.Args) (volume.PruneReport, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
Call is one recorded invocation: the method name and its arguments in declaration order (ctx excluded).
type Runtime ¶
type Runtime struct {
ContainerCreateFn func(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
ContainerStartFn func(ctx context.Context, name string, options container.StartOptions) error
ContainerStopFn func(ctx context.Context, name string, options container.StopOptions) error
ContainerRestartFn func(ctx context.Context, name string, options container.StopOptions) error
ContainerRenameFn func(ctx context.Context, name, newName string) error
ContainerRemoveFn func(ctx context.Context, name string, options container.RemoveOptions) error
ContainerInspectFn func(ctx context.Context, name string) (container.InspectResponse, error)
ContainerWaitFn func(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
ContainerListFn func(ctx context.Context, options container.ListOptions) ([]container.Summary, error)
ContainerLogsFn func(ctx context.Context, name string, options container.LogsOptions) (io.ReadCloser, error)
ContainerStatsFn func(ctx context.Context, name string, stream bool) (container.StatsResponseReader, error)
ContainersPruneFn func(ctx context.Context, pruneFilters filters.Args) (container.PruneReport, error)
ContainerExecCreateFn func(ctx context.Context, name string, options container.ExecOptions) (container.ExecCreateResponse, error)
ContainerExecStartFn func(ctx context.Context, execID string, options container.ExecStartOptions) error
ContainerExecAttachFn func(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
ContainerExecInspectFn func(ctx context.Context, execID string) (container.ExecInspect, error)
ContainerExecResizeFn func(ctx context.Context, execID string, options container.ResizeOptions) error
ImagePullFn func(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
ImagePushFn func(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
ImageTagFn func(ctx context.Context, img, ref string) error
ImageInspectFn func(ctx context.Context, img string, options ...client.ImageInspectOption) (image.InspectResponse, error)
ImageListFn func(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
ImageRemoveFn func(ctx context.Context, img string, options image.RemoveOptions) ([]image.DeleteResponse, error)
ImagesPruneFn func(ctx context.Context, pruneFilter filters.Args) (image.PruneReport, error)
VolumeCreateFn func(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)
VolumeInspectFn func(ctx context.Context, volumeID string) (volume.Volume, error)
VolumeListFn func(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error)
VolumeRemoveFn func(ctx context.Context, volumeID string, force bool) error
VolumesPruneFn func(ctx context.Context, pruneFilter filters.Args) (volume.PruneReport, error)
NetworkCreateFn func(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
NetworkConnectFn func(ctx context.Context, networkID, name string, config *network.EndpointSettings) error
NetworkDisconnectFn func(ctx context.Context, networkID, name string, force bool) error
NetworkInspectFn func(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error)
NetworkListFn func(ctx context.Context, options network.ListOptions) ([]network.Summary, error)
NetworkRemoveFn func(ctx context.Context, networkID string) error
NetworksPruneFn func(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error)
EventsFn func(ctx context.Context, options events.ListOptions) (<-chan events.Message, <-chan error)
InfoFn func(ctx context.Context) (system.Info, error)
ServerVersionFn func(ctx context.Context) (types.Version, error)
DiskUsageFn func(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
RegistryLoginFn func(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error)
PingFn func(ctx context.Context) (types.Ping, error)
CloseFn func() error
// contains filtered or unexported fields
}
Runtime records calls and plays scripted responses.
func (*Runtime) CallNames ¶
CallNames returns just the method names, in order — the quick shape assertion ("Remove then Create then Start").
func (*Runtime) ContainerCreate ¶
func (f *Runtime) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
func (*Runtime) ContainerExecAttach ¶
func (f *Runtime) ContainerExecAttach(ctx context.Context, execID string, options container.ExecAttachOptions) (types.HijackedResponse, error)
func (*Runtime) ContainerExecCreate ¶
func (f *Runtime) ContainerExecCreate(ctx context.Context, name string, options container.ExecOptions) (container.ExecCreateResponse, error)
func (*Runtime) ContainerExecInspect ¶
func (*Runtime) ContainerExecResize ¶
func (*Runtime) ContainerExecStart ¶
func (*Runtime) ContainerInspect ¶
func (*Runtime) ContainerList ¶
func (*Runtime) ContainerLogs ¶
func (f *Runtime) ContainerLogs(ctx context.Context, name string, options container.LogsOptions) (io.ReadCloser, error)
func (*Runtime) ContainerRemove ¶
func (*Runtime) ContainerRename ¶
func (*Runtime) ContainerRestart ¶
func (*Runtime) ContainerStart ¶
func (*Runtime) ContainerStats ¶
func (*Runtime) ContainerStop ¶
func (*Runtime) ContainerWait ¶
func (f *Runtime) ContainerWait(ctx context.Context, name string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
func (*Runtime) ContainersPrune ¶
func (*Runtime) ImageInspect ¶
func (f *Runtime) ImageInspect(ctx context.Context, img string, options ...client.ImageInspectOption) (image.InspectResponse, error)
func (*Runtime) ImagePull ¶
func (f *Runtime) ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
func (*Runtime) ImagePush ¶
func (f *Runtime) ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
func (*Runtime) ImageRemove ¶
func (f *Runtime) ImageRemove(ctx context.Context, img string, options image.RemoveOptions) ([]image.DeleteResponse, error)
func (*Runtime) ImagesPrune ¶
func (*Runtime) NetworkConnect ¶
func (*Runtime) NetworkCreate ¶
func (f *Runtime) NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
func (*Runtime) NetworkDisconnect ¶
func (*Runtime) NetworkInspect ¶
func (*Runtime) NetworkList ¶
func (*Runtime) NetworkRemove ¶
func (*Runtime) NetworksPrune ¶
func (*Runtime) RegistryLogin ¶
func (f *Runtime) RegistryLogin(ctx context.Context, auth registry.AuthConfig) (registry.AuthenticateOKBody, error)
func (*Runtime) ServerVersion ¶
func (*Runtime) VolumeCreate ¶
func (*Runtime) VolumeInspect ¶
func (*Runtime) VolumeList ¶
func (f *Runtime) VolumeList(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error)