Documentation ¶
Overview ¶
Package mockcore defines a mock implementation of the Core interface.
Index ¶
- Constants
- type Behavior
- type CreateContainerCall
- type ExecProcessCall
- type GetPropertiesCall
- type MockCore
- func (c *MockCore) CreateContainer(id string, settings prot.VMHostedContainerSettings) error
- func (c *MockCore) ExecProcess(id string, params prot.ProcessParameters, conSettings stdio.ConnectionSettings) (pid int, execInitErrorDone chan<- struct{}, err error)
- func (c *MockCore) GetProperties(id string, query string) (*prot.Properties, error)
- func (c *MockCore) ModifySettings(id string, request *prot.ResourceModificationRequestResponse) error
- func (c *MockCore) ResizeConsole(pid int, height, width uint16) error
- func (c *MockCore) RunExternalProcess(params prot.ProcessParameters, conSettings stdio.ConnectionSettings) (pid int, err error)
- func (c *MockCore) SignalContainer(id string, signal syscall.Signal) error
- func (c *MockCore) SignalProcess(pid int, options prot.SignalProcessOptions) error
- func (c *MockCore) WaitContainer(id string) (func() prot.NotificationType, error)
- func (c *MockCore) WaitProcess(pid int) (<-chan int, chan<- bool, error)
- type ModifySettingsCall
- type ResizeConsoleCall
- type RunExternalProcessCall
- type SignalContainerCall
- type SignalProcessCall
- type WaitContainerCall
- type WaitProcessCall
- type WaitProcessReturnContext
Constants ¶
const ( // Success specifies method calls should succeed. Success = iota // Error specifies method calls should return an error. Error // SingleSuccess specifies that the first method call should succeed and additional // calls should return an error. SingleSuccess )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Behavior ¶ added in v0.3.4
type Behavior int
Behavior describes the behavior of the mock core when a method is called.
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 ConnectionSettings stdio.ConnectionSettings }
ExecProcessCall captures the arguments of ExecProcess.
type GetPropertiesCall ¶ added in v0.3.6
GetPropertiesCall captures the arguments of GetProperties.
type MockCore ¶
type MockCore struct { Behavior Behavior LastCreateContainer CreateContainerCall LastExecProcess ExecProcessCall LastSignalContainer SignalContainerCall LastSignalProcess SignalProcessCall LastGetProperties GetPropertiesCall LastRunExternalProcess RunExternalProcessCall LastModifySettings ModifySettingsCall LastResizeConsole ResizeConsoleCall LastWaitContainer WaitContainerCall LastWaitProcess WaitProcessCall LastWaitProcessReturnContext *WaitProcessReturnContext WaitContainerWg sync.WaitGroup }
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.
func (*MockCore) ExecProcess ¶
func (c *MockCore) ExecProcess(id string, params prot.ProcessParameters, conSettings stdio.ConnectionSettings) (pid int, execInitErrorDone chan<- struct{}, err error)
ExecProcess captures its arguments and returns pid 101.
func (*MockCore) GetProperties ¶ added in v0.3.6
GetProperties captures its arguments. It then returns a properties with a process with pid 101.
func (*MockCore) ModifySettings ¶
func (c *MockCore) ModifySettings(id string, request *prot.ResourceModificationRequestResponse) error
ModifySettings captures its arguments.
func (*MockCore) ResizeConsole ¶
ResizeConsole captures its arguments and returns a nil error.
func (*MockCore) RunExternalProcess ¶
func (c *MockCore) RunExternalProcess(params prot.ProcessParameters, conSettings stdio.ConnectionSettings) (pid int, err error)
RunExternalProcess captures its arguments and returns pid 101.
func (*MockCore) SignalContainer ¶
SignalContainer captures its arguments.
func (*MockCore) SignalProcess ¶
func (c *MockCore) SignalProcess(pid int, options prot.SignalProcessOptions) error
SignalProcess captures its arguments.
func (*MockCore) WaitContainer ¶ added in v0.3.4
func (c *MockCore) WaitContainer(id string) (func() prot.NotificationType, error)
WaitContainer 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 ResizeConsoleCall ¶
ResizeConsoleCall captures the arguments of ResizeConsole
type RunExternalProcessCall ¶
type RunExternalProcessCall struct { Params prot.ProcessParameters ConnectionSettings stdio.ConnectionSettings }
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.
type WaitContainerCall ¶ added in v0.3.4
type WaitContainerCall struct {
ID string
}
WaitContainerCall captures the arguments of WaitContainer
type WaitProcessCall ¶ added in v0.3.4
type WaitProcessCall struct {
Pid int
}
WaitProcessCall captures the arguments of WaitProcess
type WaitProcessReturnContext ¶ added in v0.3.5
WaitProcessReturnContext captures the return context of a WaitProcess call.