Documentation ¶
Overview ¶
Package mockcore defines a mock implementation of the Core interface.
Index ¶
- type CreateContainerCall
- type ExecProcessCall
- type ListProcessesCall
- type MockCore
- func (c *MockCore) CreateContainer(id string, settings prot.VMHostedContainerSettings) error
- func (c *MockCore) ExecProcess(id string, params prot.ProcessParameters, stdioSet *stdio.ConnectionSet) (pid int, err error)
- func (c *MockCore) ListProcesses(id string) ([]runtime.ContainerProcessState, error)
- func (c *MockCore) ModifySettings(id string, request prot.ResourceModificationRequestResponse) error
- func (c *MockCore) RegisterContainerExitHook(id string, exitHook func(oslayer.ProcessExitState)) error
- func (c *MockCore) RegisterProcessExitHook(pid int, exitHook func(oslayer.ProcessExitState)) error
- func (c *MockCore) ResizeConsole(pid int, height, width uint16) error
- func (c *MockCore) RunExternalProcess(params prot.ProcessParameters, stdioSet *stdio.ConnectionSet) (pid int, err error)
- func (c *MockCore) SignalContainer(id string, signal oslayer.Signal) error
- func (c *MockCore) SignalProcess(pid int, options prot.SignalProcessOptions) error
- type ModifySettingsCall
- type RegisterContainerExitHookCall
- type RegisterProcessExitHookCall
- type ResizeConsoleCall
- type RunExternalProcessCall
- type SignalContainerCall
- type SignalProcessCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateContainerCall ¶
type CreateContainerCall struct { ID string Settings prot.VMHostedContainerSettings }
CreateContainerCall captures the arguments of CreateContainer.
type ExecProcessCall ¶
type ExecProcessCall struct { ID string Params prot.ProcessParameters StdioSet *stdio.ConnectionSet }
ExecProcessCall captures the arguments of ExecProcess.
type ListProcessesCall ¶
type ListProcessesCall struct {
ID string
}
ListProcessesCall captures the arguments of ListProcesses.
type MockCore ¶
type MockCore struct { LastCreateContainer CreateContainerCall LastExecProcess ExecProcessCall LastSignalContainer SignalContainerCall LastSignalProcess SignalProcessCall LastListProcesses ListProcessesCall LastRunExternalProcess RunExternalProcessCall LastModifySettings ModifySettingsCall LastRegisterContainerExitHook RegisterContainerExitHookCall LastRegisterProcessExitHook RegisterProcessExitHookCall LastResizeConsole ResizeConsoleCall }
MockCore serves as an argument capture mechanism which implements the Core interface. Arguments passed to one of its methods are stored to be queried later.
func (*MockCore) CreateContainer ¶
func (c *MockCore) CreateContainer(id string, settings prot.VMHostedContainerSettings) error
CreateContainer captures its arguments and returns a nil error.
func (*MockCore) ExecProcess ¶
func (c *MockCore) ExecProcess(id string, params prot.ProcessParameters, stdioSet *stdio.ConnectionSet) (pid int, err error)
ExecProcess captures its arguments and returns pid 101 and a nil error.
func (*MockCore) ListProcesses ¶
func (c *MockCore) ListProcesses(id string) ([]runtime.ContainerProcessState, error)
ListProcesses captures its arguments. It then returns a process with pid 101, command "sh -c testexe", CreatedByRuntime true, and IsZombie true, as well as a nil error.
func (*MockCore) ModifySettings ¶
func (c *MockCore) ModifySettings(id string, request prot.ResourceModificationRequestResponse) error
ModifySettings captures its arguments and returns a nil error.
func (*MockCore) RegisterContainerExitHook ¶
func (c *MockCore) RegisterContainerExitHook(id string, exitHook func(oslayer.ProcessExitState)) error
RegisterContainerExitHook captures its arguments and returns a nil error.
func (*MockCore) RegisterProcessExitHook ¶
func (c *MockCore) RegisterProcessExitHook(pid int, exitHook func(oslayer.ProcessExitState)) error
RegisterProcessExitHook captures its arguments, runs the given exit hook on a process exit state with exit code 103, and returns a nil error.
func (*MockCore) ResizeConsole ¶
ResizeConsole captures its arguments and returns a nil error.
func (*MockCore) RunExternalProcess ¶
func (c *MockCore) RunExternalProcess(params prot.ProcessParameters, stdioSet *stdio.ConnectionSet) (pid int, err error)
RunExternalProcess captures its arguments and returns pid 101 and a nil error.
func (*MockCore) SignalContainer ¶
SignalContainer captures its arguments and returns a nil error.
func (*MockCore) SignalProcess ¶
func (c *MockCore) SignalProcess(pid int, options prot.SignalProcessOptions) error
SignalProcess captures its arguments and returns a nil error.
type ModifySettingsCall ¶
type ModifySettingsCall struct { ID string Request prot.ResourceModificationRequestResponse }
ModifySettingsCall captures the arguments of ModifySettings.
type RegisterContainerExitHookCall ¶
type RegisterContainerExitHookCall struct { ID string ExitHook func(oslayer.ProcessExitState) }
RegisterContainerExitHookCall captures the arguments of RegisterContainerExitHook.
type RegisterProcessExitHookCall ¶
type RegisterProcessExitHookCall struct { Pid int ExitHook func(oslayer.ProcessExitState) }
RegisterProcessExitHookCall captures the arguments of RegisterProcessExitHook.
type ResizeConsoleCall ¶
ResizeConsoleCall captures the arguments of ResizeConsole
type RunExternalProcessCall ¶
type RunExternalProcessCall struct { Params prot.ProcessParameters StdioSet *stdio.ConnectionSet }
RunExternalProcessCall captures the arguments of RunExternalProcess.
type SignalContainerCall ¶
SignalContainerCall captures the arguments of SignalContainer.
type SignalProcessCall ¶
type SignalProcessCall struct { Pid int Options prot.SignalProcessOptions }
SignalProcessCall captures the arguments of SignalProcess.