Documentation ¶
Index ¶
- Variables
- func BuildContainerName(metadata *runtimeapi.ContainerMetadata, sandboxID string) string
- func BuildSandboxName(metadata *runtimeapi.PodSandboxMetadata) string
- type FakeContainer
- type FakeImageService
- func (r *FakeImageService) AssertImagePulledWithAuth(t *testing.T, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, ...)
- func (r *FakeImageService) ImageFsInfo() ([]*runtimeapi.FilesystemUsage, error)
- func (r *FakeImageService) ImageStatus(image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
- func (r *FakeImageService) InjectError(f string, err error)
- func (r *FakeImageService) ListImages(filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
- func (r *FakeImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, ...) (string, error)
- func (r *FakeImageService) RemoveImage(image *runtimeapi.ImageSpec) error
- func (r *FakeImageService) SetFakeFilesystemUsage(usage []*runtimeapi.FilesystemUsage)
- func (r *FakeImageService) SetFakeImageSize(size uint64)
- func (r *FakeImageService) SetFakeImages(images []string)
- func (r *FakeImageService) SetFakeImagesWithAnnotations(imageSpecs []*runtimeapi.ImageSpec)
- type FakePodSandbox
- type FakeRuntimeService
- func (r *FakeRuntimeService) AssertCalls(calls []string) error
- func (r *FakeRuntimeService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
- func (r *FakeRuntimeService) ContainerStats(containerID string) (*runtimeapi.ContainerStats, error)
- func (r *FakeRuntimeService) ContainerStatus(containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
- func (r *FakeRuntimeService) CreateContainer(podSandboxID string, config *runtimeapi.ContainerConfig, ...) (string, error)
- func (r *FakeRuntimeService) Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
- func (r *FakeRuntimeService) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
- func (r *FakeRuntimeService) GetCalls() []string
- func (r *FakeRuntimeService) GetContainerID(sandboxID, name string, attempt uint32) (string, error)
- func (r *FakeRuntimeService) InjectError(f string, err error)
- func (r *FakeRuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
- func (r *FakeRuntimeService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
- func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
- func (r *FakeRuntimeService) ListPodSandboxStats(filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
- func (r *FakeRuntimeService) PodSandboxStats(podSandboxID string) (*runtimeapi.PodSandboxStats, error)
- func (r *FakeRuntimeService) PodSandboxStatus(podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
- func (r *FakeRuntimeService) PortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
- func (r *FakeRuntimeService) RemoveContainer(containerID string) error
- func (r *FakeRuntimeService) RemovePodSandbox(podSandboxID string) error
- func (r *FakeRuntimeService) ReopenContainerLog(containerID string) error
- func (r *FakeRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
- func (r *FakeRuntimeService) SetFakeContainerStats(containerStats []*runtimeapi.ContainerStats)
- func (r *FakeRuntimeService) SetFakeContainers(containers []*FakeContainer)
- func (r *FakeRuntimeService) SetFakePodSandboxStats(podStats []*runtimeapi.PodSandboxStats)
- func (r *FakeRuntimeService) SetFakeSandboxes(sandboxes []*FakePodSandbox)
- func (r *FakeRuntimeService) StartContainer(containerID string) error
- func (r *FakeRuntimeService) Status(verbose bool) (*runtimeapi.StatusResponse, error)
- func (r *FakeRuntimeService) StopContainer(containerID string, timeout int64) error
- func (r *FakeRuntimeService) StopPodSandbox(podSandboxID string) error
- func (r *FakeRuntimeService) UpdateContainerResources(string, *runtimeapi.LinuxContainerResources) error
- func (r *FakeRuntimeService) UpdateRuntimeConfig(runtimeCOnfig *runtimeapi.RuntimeConfig) error
- func (r *FakeRuntimeService) Version(apiVersion string) (*runtimeapi.VersionResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( // FakeVersion is a version of a fake runtime. FakeVersion = "0.1.0" // FakeRuntimeName is the name of the fake runtime. FakeRuntimeName = "fakeRuntime" // FakePodSandboxIPs is an IP address of the fake runtime. FakePodSandboxIPs = []string{"192.168.192.168"} )
Functions ¶
func BuildContainerName ¶
func BuildContainerName(metadata *runtimeapi.ContainerMetadata, sandboxID string) string
BuildContainerName creates a unique container name string.
func BuildSandboxName ¶
func BuildSandboxName(metadata *runtimeapi.PodSandboxMetadata) string
BuildSandboxName creates a unique sandbox name string.
Types ¶
type FakeContainer ¶
type FakeContainer struct { // ContainerStatus contains the runtime information for a container. runtimeapi.ContainerStatus // LinuxResources contains the resources specific to linux containers. LinuxResources *runtimeapi.LinuxContainerResources // the sandbox id of this container SandboxID string }
FakeContainer is a fake container.
type FakeImageService ¶
type FakeImageService struct { sync.Mutex FakeImageSize uint64 Called []string Errors map[string][]error Images map[string]*runtimeapi.Image FakeFilesystemUsage []*runtimeapi.FilesystemUsage // contains filtered or unexported fields }
FakeImageService fakes the image service.
func NewFakeImageService ¶
func NewFakeImageService() *FakeImageService
NewFakeImageService creates a new FakeImageService.
func (*FakeImageService) AssertImagePulledWithAuth ¶
func (r *FakeImageService) AssertImagePulledWithAuth(t *testing.T, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, failMsg string)
AssertImagePulledWithAuth validates whether the image was pulled with auth and asserts if it wasn't.
func (*FakeImageService) ImageFsInfo ¶
func (r *FakeImageService) ImageFsInfo() ([]*runtimeapi.FilesystemUsage, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*FakeImageService) ImageStatus ¶
func (r *FakeImageService) ImageStatus(image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
ImageStatus returns the status of the image from the FakeImageService.
func (*FakeImageService) InjectError ¶ added in v0.18.0
func (r *FakeImageService) InjectError(f string, err error)
InjectError sets the error message for the FakeImageService.
func (*FakeImageService) ListImages ¶
func (r *FakeImageService) ListImages(filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
ListImages returns the list of images from FakeImageService or error if it was previously set.
func (*FakeImageService) PullImage ¶
func (r *FakeImageService) PullImage(image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
PullImage emulate pulling the image from the FakeImageService.
func (*FakeImageService) RemoveImage ¶
func (r *FakeImageService) RemoveImage(image *runtimeapi.ImageSpec) error
RemoveImage removes image from the FakeImageService.
func (*FakeImageService) SetFakeFilesystemUsage ¶
func (r *FakeImageService) SetFakeFilesystemUsage(usage []*runtimeapi.FilesystemUsage)
SetFakeFilesystemUsage sets the FilesystemUsage for FakeImageService.
func (*FakeImageService) SetFakeImageSize ¶
func (r *FakeImageService) SetFakeImageSize(size uint64)
SetFakeImageSize sets the image size for the FakeImageService.
func (*FakeImageService) SetFakeImages ¶
func (r *FakeImageService) SetFakeImages(images []string)
SetFakeImages sets the list of fake images for the FakeImageService.
func (*FakeImageService) SetFakeImagesWithAnnotations ¶ added in v0.19.0
func (r *FakeImageService) SetFakeImagesWithAnnotations(imageSpecs []*runtimeapi.ImageSpec)
SetFakeImagesWithAnnotations sets the list of fake images for the FakeImageService with annotations.
type FakePodSandbox ¶
type FakePodSandbox struct { // PodSandboxStatus contains the runtime information for a sandbox. runtimeapi.PodSandboxStatus // RuntimeHandler is the runtime handler that was issued with the RunPodSandbox request. RuntimeHandler string }
FakePodSandbox is the fake implementation of runtimeapi.PodSandboxStatus.
type FakeRuntimeService ¶
type FakeRuntimeService struct { sync.Mutex Called []string Errors map[string][]error FakeStatus *runtimeapi.RuntimeStatus Containers map[string]*FakeContainer Sandboxes map[string]*FakePodSandbox FakeContainerStats map[string]*runtimeapi.ContainerStats FakePodSandboxStats map[string]*runtimeapi.PodSandboxStats ErrorOnSandboxCreate bool }
FakeRuntimeService is a fake runetime service.
func NewFakeRuntimeService ¶
func NewFakeRuntimeService() *FakeRuntimeService
NewFakeRuntimeService creates a new FakeRuntimeService.
func (*FakeRuntimeService) AssertCalls ¶
func (r *FakeRuntimeService) AssertCalls(calls []string) error
AssertCalls validates whether specified calls were made to the FakeRuntimeService.
func (*FakeRuntimeService) Attach ¶
func (r *FakeRuntimeService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
Attach emulates the attach request in the FakeRuntimeService.
func (*FakeRuntimeService) ContainerStats ¶
func (r *FakeRuntimeService) ContainerStats(containerID string) (*runtimeapi.ContainerStats, error)
ContainerStats returns the container stats in the FakeRuntimeService.
func (*FakeRuntimeService) ContainerStatus ¶
func (r *FakeRuntimeService) ContainerStatus(containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
ContainerStatus returns the container status given the container ID in FakeRuntimeService.
func (*FakeRuntimeService) CreateContainer ¶
func (r *FakeRuntimeService) CreateContainer(podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
CreateContainer emulates container creation in the FakeRuntimeService.
func (*FakeRuntimeService) Exec ¶
func (r *FakeRuntimeService) Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
Exec emulates the execution of a command in a container in the FakeRuntimeService.
func (*FakeRuntimeService) ExecSync ¶
func (r *FakeRuntimeService) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
ExecSync emulates the sync execution of a command in a container in the FakeRuntimeService.
func (*FakeRuntimeService) GetCalls ¶
func (r *FakeRuntimeService) GetCalls() []string
GetCalls returns the list of calls made to the FakeRuntimeService.
func (*FakeRuntimeService) GetContainerID ¶
func (r *FakeRuntimeService) GetContainerID(sandboxID, name string, attempt uint32) (string, error)
GetContainerID returns the unique container ID from the FakeRuntimeService.
func (*FakeRuntimeService) InjectError ¶
func (r *FakeRuntimeService) InjectError(f string, err error)
InjectError inject the error to the next call to the FakeRuntimeService.
func (*FakeRuntimeService) ListContainerStats ¶
func (r *FakeRuntimeService) ListContainerStats(filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
ListContainerStats returns the list of all container stats given the filter in the FakeRuntimeService.
func (*FakeRuntimeService) ListContainers ¶
func (r *FakeRuntimeService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
ListContainers returns the list of containers in the FakeRuntimeService.
func (*FakeRuntimeService) ListPodSandbox ¶
func (r *FakeRuntimeService) ListPodSandbox(filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
ListPodSandbox returns the list of pod sandboxes in the FakeRuntimeService.
func (*FakeRuntimeService) ListPodSandboxStats ¶ added in v0.23.0
func (r *FakeRuntimeService) ListPodSandboxStats(filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
ListPodSandboxStats returns the list of all pod sandbox stats given the filter in the FakeRuntimeService.
func (*FakeRuntimeService) PodSandboxStats ¶ added in v0.23.0
func (r *FakeRuntimeService) PodSandboxStats(podSandboxID string) (*runtimeapi.PodSandboxStats, error)
PodSandboxStats returns the sandbox stats in the FakeRuntimeService.
func (*FakeRuntimeService) PodSandboxStatus ¶
func (r *FakeRuntimeService) PodSandboxStatus(podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
PodSandboxStatus returns pod sandbox status from the FakeRuntimeService.
func (*FakeRuntimeService) PortForward ¶
func (r *FakeRuntimeService) PortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
PortForward emulates the set up of port forward in the FakeRuntimeService.
func (*FakeRuntimeService) RemoveContainer ¶
func (r *FakeRuntimeService) RemoveContainer(containerID string) error
RemoveContainer emulates remove of a container in the FakeRuntimeService.
func (*FakeRuntimeService) RemovePodSandbox ¶
func (r *FakeRuntimeService) RemovePodSandbox(podSandboxID string) error
RemovePodSandbox emulates removal of the pod sadbox in the FakeRuntimeService.
func (*FakeRuntimeService) ReopenContainerLog ¶
func (r *FakeRuntimeService) ReopenContainerLog(containerID string) error
ReopenContainerLog emulates call to the reopen container log in the FakeRuntimeService.
func (*FakeRuntimeService) RunPodSandbox ¶
func (r *FakeRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
RunPodSandbox emulates the run of the pod sandbox in the FakeRuntimeService.
func (*FakeRuntimeService) SetFakeContainerStats ¶
func (r *FakeRuntimeService) SetFakeContainerStats(containerStats []*runtimeapi.ContainerStats)
SetFakeContainerStats sets the fake container stats in the FakeRuntimeService.
func (*FakeRuntimeService) SetFakeContainers ¶
func (r *FakeRuntimeService) SetFakeContainers(containers []*FakeContainer)
SetFakeContainers sets fake containers for the FakeRuntimeService.
func (*FakeRuntimeService) SetFakePodSandboxStats ¶ added in v0.23.0
func (r *FakeRuntimeService) SetFakePodSandboxStats(podStats []*runtimeapi.PodSandboxStats)
SetFakePodSandboxStats sets the fake pod sandbox stats in the FakeRuntimeService.
func (*FakeRuntimeService) SetFakeSandboxes ¶
func (r *FakeRuntimeService) SetFakeSandboxes(sandboxes []*FakePodSandbox)
SetFakeSandboxes sets the fake sandboxes for the FakeRuntimeService.
func (*FakeRuntimeService) StartContainer ¶
func (r *FakeRuntimeService) StartContainer(containerID string) error
StartContainer emulates start of a container in the FakeRuntimeService.
func (*FakeRuntimeService) Status ¶
func (r *FakeRuntimeService) Status(verbose bool) (*runtimeapi.StatusResponse, error)
Status returns runtime status of the FakeRuntimeService.
func (*FakeRuntimeService) StopContainer ¶
func (r *FakeRuntimeService) StopContainer(containerID string, timeout int64) error
StopContainer emulates stop of a container in the FakeRuntimeService.
func (*FakeRuntimeService) StopPodSandbox ¶
func (r *FakeRuntimeService) StopPodSandbox(podSandboxID string) error
StopPodSandbox emulates the stop of pod sandbox in the FakeRuntimeService.
func (*FakeRuntimeService) UpdateContainerResources ¶
func (r *FakeRuntimeService) UpdateContainerResources(string, *runtimeapi.LinuxContainerResources) error
UpdateContainerResources returns the container resource in the FakeRuntimeService.
func (*FakeRuntimeService) UpdateRuntimeConfig ¶
func (r *FakeRuntimeService) UpdateRuntimeConfig(runtimeCOnfig *runtimeapi.RuntimeConfig) error
UpdateRuntimeConfig emulates the update of a runtime config for the FakeRuntimeService.
func (*FakeRuntimeService) Version ¶
func (r *FakeRuntimeService) Version(apiVersion string) (*runtimeapi.VersionResponse, error)
Version returns version information from the FakeRuntimeService.