Documentation
¶
Overview ¶
Package dockerfake models the small Docker daemon contract used by tests. It is a recording daemon, not a deployment driver or AppTown fixture.
Index ¶
- func IsDiskRead(args []string) bool
- func RoomyDisk(args []string) ([]byte, bool)
- type Daemon
- func (d *Daemon) Close()
- func (d *Daemon) Commands() [][]string
- func (d *Daemon) Configs() []string
- func (d *Daemon) Limits(name string) (memory, nanoCPUs int64)
- func (d *Daemon) Matching(prefix string) [][]string
- func (d *Daemon) PublishPorts()
- func (d *Daemon) ResetCommands()
- func (d *Daemon) Run(_ context.Context, _ string, req docker.Command) ([]byte, error)
- func (d *Daemon) Running(name string) bool
- func (d *Daemon) SetCommandReply(reply func(docker.Command) ([]byte, error, bool))
- func (d *Daemon) SetDisk(totalBytes, freeBytes int64)
- func (d *Daemon) SetExitCode(name string, code int)
- func (d *Daemon) SetHostInfo(memoryBytes int64, cpus int, dataRoot string)
- func (d *Daemon) SetOOMKilled(name string, killed bool)
- func (d *Daemon) SetPort(port int)
- func (d *Daemon) SetReply(reply func([]string) ([]byte, error, bool))
- func (d *Daemon) SetRestartCount(name string, count int)
- func (d *Daemon) SetRunning(name string, running bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDiskRead ¶
IsDiskRead says args is the disk read's throwaway container, which changes nothing on the host.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func (*Daemon) Configs ¶
Configs are the client configuration each command named, in order ("" is the ambient one).
func (*Daemon) Limits ¶
Limits is the memory and NanoCPUs the daemon holds a container to, as its runs and updates set them (0: no limit).
func (*Daemon) PublishPorts ¶
func (d *Daemon) PublishPorts()
PublishPorts makes the daemon publish a container's port as Docker does: a container run with `-p addr:N:inner` answers at N from every start, and one run with `-p addr::inner` answers at a port Docker picks at each start (run, start, restart), so the port it had before goes dead. Each published port relays to the port SetPort names. Without it every running container answers at that port. Close stops the relays.
func (*Daemon) ResetCommands ¶
func (d *Daemon) ResetCommands()
func (*Daemon) SetCommandReply ¶
SetCommandReply scripts stream-bearing commands such as backup copies. The callback must not call methods on this daemon while Run holds its lock.
func (*Daemon) SetDisk ¶
SetDisk scripts what df says of the data folder's filesystem (100 GiB with 90 GiB free unless set).
func (*Daemon) SetExitCode ¶
SetExitCode scripts the container's last exit code.
func (*Daemon) SetHostInfo ¶
SetHostInfo scripts what docker info says the daemon can give containers (8 GiB and 8 CPUs unless set).
func (*Daemon) SetOOMKilled ¶
SetOOMKilled scripts whether the container's last exit was an out-of-memory kill, what its inspected state says.
func (*Daemon) SetReply ¶
SetReply scripts a daemon response after recording the command. Returning false lets the daemon answer from its ordinary container state.
func (*Daemon) SetRestartCount ¶
SetRestartCount scripts Docker's restart-policy counter for a container, what `inspect -f {{.RestartCount}}` answers.