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(_ context.Context) ([]*runtimeapi.FilesystemUsage, error)
- func (r *FakeImageService) ImageStatus(_ context.Context, image *runtimeapi.ImageSpec, verbose bool) (*runtimeapi.ImageStatusResponse, error)
- func (r *FakeImageService) InjectError(f string, err error)
- func (r *FakeImageService) ListImages(_ context.Context, filter *runtimeapi.ImageFilter) ([]*runtimeapi.Image, error)
- func (r *FakeImageService) PullImage(_ context.Context, image *runtimeapi.ImageSpec, auth *runtimeapi.AuthConfig, ...) (string, error)
- func (r *FakeImageService) RemoveImage(_ context.Context, image *runtimeapi.ImageSpec) error
- func (r *FakeImageService) SetFakeFilesystemUsage(usage []*runtimeapi.FilesystemUsage)
- func (r *FakeImageService) SetFakeImagePinned(image string, pinned bool)
- 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(_ context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
- func (r *FakeRuntimeService) CheckpointContainer(_ context.Context, options *runtimeapi.CheckpointContainerRequest) error
- func (r *FakeRuntimeService) ContainerStats(_ context.Context, containerID string) (*runtimeapi.ContainerStats, error)
- func (r *FakeRuntimeService) ContainerStatus(_ context.Context, containerID string, verbose bool) (*runtimeapi.ContainerStatusResponse, error)
- func (r *FakeRuntimeService) CreateContainer(_ context.Context, podSandboxID string, config *runtimeapi.ContainerConfig, ...) (string, error)
- func (r *FakeRuntimeService) Exec(context.Context, *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
- func (r *FakeRuntimeService) ExecSync(_ context.Context, containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error)
- func (r *FakeRuntimeService) GetCalls() []string
- func (f *FakeRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error
- func (r *FakeRuntimeService) GetContainerID(sandboxID, name string, attempt uint32) (string, error)
- func (r *FakeRuntimeService) InjectError(f string, err error)
- func (r *FakeRuntimeService) ListContainerStats(_ context.Context, filter *runtimeapi.ContainerStatsFilter) ([]*runtimeapi.ContainerStats, error)
- func (r *FakeRuntimeService) ListContainers(_ context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
- func (r *FakeRuntimeService) ListMetricDescriptors(_ context.Context) ([]*runtimeapi.MetricDescriptor, error)
- func (r *FakeRuntimeService) ListPodSandbox(_ context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
- func (r *FakeRuntimeService) ListPodSandboxMetrics(_ context.Context) ([]*runtimeapi.PodSandboxMetrics, error)
- func (r *FakeRuntimeService) ListPodSandboxStats(_ context.Context, filter *runtimeapi.PodSandboxStatsFilter) ([]*runtimeapi.PodSandboxStats, error)
- func (r *FakeRuntimeService) PodSandboxStats(_ context.Context, podSandboxID string) (*runtimeapi.PodSandboxStats, error)
- func (r *FakeRuntimeService) PodSandboxStatus(_ context.Context, podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
- func (r *FakeRuntimeService) PortForward(context.Context, *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
- func (r *FakeRuntimeService) RemoveContainer(_ context.Context, containerID string) error
- func (r *FakeRuntimeService) RemovePodSandbox(_ context.Context, podSandboxID string) error
- func (r *FakeRuntimeService) ReopenContainerLog(_ context.Context, containerID string) error
- func (r *FakeRuntimeService) RunPodSandbox(_ context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
- func (r *FakeRuntimeService) RuntimeConfig(_ context.Context) (*runtimeapi.RuntimeConfigResponse, error)
- func (r *FakeRuntimeService) SetFakeContainerStats(containerStats []*runtimeapi.ContainerStats)
- func (r *FakeRuntimeService) SetFakeContainers(containers []*FakeContainer)
- func (r *FakeRuntimeService) SetFakeMetricDescriptors(descs []*runtimeapi.MetricDescriptor)
- func (r *FakeRuntimeService) SetFakePodSandboxMetrics(podStats []*runtimeapi.PodSandboxMetrics)
- func (r *FakeRuntimeService) SetFakePodSandboxStats(podStats []*runtimeapi.PodSandboxStats)
- func (r *FakeRuntimeService) SetFakeSandboxes(sandboxes []*FakePodSandbox)
- func (r *FakeRuntimeService) StartContainer(_ context.Context, containerID string) error
- func (r *FakeRuntimeService) Status(_ context.Context, verbose bool) (*runtimeapi.StatusResponse, error)
- func (r *FakeRuntimeService) StopContainer(_ context.Context, containerID string, timeout int64) error
- func (r *FakeRuntimeService) StopPodSandbox(_ context.Context, podSandboxID string) error
- func (r *FakeRuntimeService) UpdateContainerResources(context.Context, string, *runtimeapi.ContainerResources) error
- func (r *FakeRuntimeService) UpdateRuntimeConfig(_ context.Context, runtimeCOnfig *runtimeapi.RuntimeConfig) error
- func (r *FakeRuntimeService) Version(_ context.Context, 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 Pinned map[string]bool 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(_ context.Context) ([]*runtimeapi.FilesystemUsage, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*FakeImageService) ImageStatus ¶
func (r *FakeImageService) ImageStatus(_ context.Context, 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(_ context.Context, 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(_ context.Context, 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(_ context.Context, 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) SetFakeImagePinned ¶ added in v0.25.14
func (r *FakeImageService) SetFakeImagePinned(image string, pinned bool)
SetFakeImagePinned sets the image Pinned field for one image.
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 FakePodSandboxMetrics map[string]*runtimeapi.PodSandboxMetrics FakeMetricDescriptors map[string]*runtimeapi.MetricDescriptor FakeContainerMetrics map[string]*runtimeapi.ContainerMetrics FakeLinuxConfiguration *runtimeapi.LinuxRuntimeConfiguration 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(_ context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
Attach emulates the attach request in the FakeRuntimeService.
func (*FakeRuntimeService) CheckpointContainer ¶ added in v0.25.0
func (r *FakeRuntimeService) CheckpointContainer(_ context.Context, options *runtimeapi.CheckpointContainerRequest) error
CheckpointContainer emulates call to checkpoint a container in the FakeRuntimeService.
func (*FakeRuntimeService) ContainerStats ¶
func (r *FakeRuntimeService) ContainerStats(_ context.Context, containerID string) (*runtimeapi.ContainerStats, error)
ContainerStats returns the container stats in the FakeRuntimeService.
func (*FakeRuntimeService) ContainerStatus ¶
func (r *FakeRuntimeService) ContainerStatus(_ context.Context, 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(_ context.Context, podSandboxID string, config *runtimeapi.ContainerConfig, sandboxConfig *runtimeapi.PodSandboxConfig) (string, error)
CreateContainer emulates container creation in the FakeRuntimeService.
func (*FakeRuntimeService) Exec ¶
func (r *FakeRuntimeService) Exec(context.Context, *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(_ context.Context, 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) GetContainerEvents ¶ added in v0.25.0
func (f *FakeRuntimeService) GetContainerEvents(containerEventsCh chan *runtimeapi.ContainerEventResponse) error
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(_ context.Context, 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(_ context.Context, filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error)
ListContainers returns the list of containers in the FakeRuntimeService.
func (*FakeRuntimeService) ListMetricDescriptors ¶ added in v0.26.0
func (r *FakeRuntimeService) ListMetricDescriptors(_ context.Context) ([]*runtimeapi.MetricDescriptor, error)
ListMetricDescriptors gets the descriptors for the metrics that will be returned in ListPodSandboxMetrics.
func (*FakeRuntimeService) ListPodSandbox ¶
func (r *FakeRuntimeService) ListPodSandbox(_ context.Context, filter *runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error)
ListPodSandbox returns the list of pod sandboxes in the FakeRuntimeService.
func (*FakeRuntimeService) ListPodSandboxMetrics ¶ added in v0.26.0
func (r *FakeRuntimeService) ListPodSandboxMetrics(_ context.Context) ([]*runtimeapi.PodSandboxMetrics, error)
ListPodSandboxMetrics returns the list of all pod sandbox metrics in the FakeRuntimeService.
func (*FakeRuntimeService) ListPodSandboxStats ¶ added in v0.23.0
func (r *FakeRuntimeService) ListPodSandboxStats(_ context.Context, 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(_ context.Context, podSandboxID string) (*runtimeapi.PodSandboxStats, error)
PodSandboxStats returns the sandbox stats in the FakeRuntimeService.
func (*FakeRuntimeService) PodSandboxStatus ¶
func (r *FakeRuntimeService) PodSandboxStatus(_ context.Context, podSandboxID string, verbose bool) (*runtimeapi.PodSandboxStatusResponse, error)
PodSandboxStatus returns pod sandbox status from the FakeRuntimeService.
func (*FakeRuntimeService) PortForward ¶
func (r *FakeRuntimeService) PortForward(context.Context, *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
PortForward emulates the set up of port forward in the FakeRuntimeService.
func (*FakeRuntimeService) RemoveContainer ¶
func (r *FakeRuntimeService) RemoveContainer(_ context.Context, containerID string) error
RemoveContainer emulates remove of a container in the FakeRuntimeService.
func (*FakeRuntimeService) RemovePodSandbox ¶
func (r *FakeRuntimeService) RemovePodSandbox(_ context.Context, podSandboxID string) error
RemovePodSandbox emulates removal of the pod sadbox in the FakeRuntimeService.
func (*FakeRuntimeService) ReopenContainerLog ¶
func (r *FakeRuntimeService) ReopenContainerLog(_ context.Context, containerID string) error
ReopenContainerLog emulates call to the reopen container log in the FakeRuntimeService.
func (*FakeRuntimeService) RunPodSandbox ¶
func (r *FakeRuntimeService) RunPodSandbox(_ context.Context, config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
RunPodSandbox emulates the run of the pod sandbox in the FakeRuntimeService.
func (*FakeRuntimeService) RuntimeConfig ¶ added in v0.28.0
func (r *FakeRuntimeService) RuntimeConfig(_ context.Context) (*runtimeapi.RuntimeConfigResponse, error)
RuntimeConfig returns runtime configuration of 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) SetFakeMetricDescriptors ¶ added in v0.26.0
func (r *FakeRuntimeService) SetFakeMetricDescriptors(descs []*runtimeapi.MetricDescriptor)
SetFakeMetricDescriptors sets the fake metrics descriptors in the FakeRuntimeService.
func (*FakeRuntimeService) SetFakePodSandboxMetrics ¶ added in v0.26.0
func (r *FakeRuntimeService) SetFakePodSandboxMetrics(podStats []*runtimeapi.PodSandboxMetrics)
SetFakePodSandboxMetrics sets the fake pod sandbox metrics in 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(_ context.Context, containerID string) error
StartContainer emulates start of a container in the FakeRuntimeService.
func (*FakeRuntimeService) Status ¶
func (r *FakeRuntimeService) Status(_ context.Context, verbose bool) (*runtimeapi.StatusResponse, error)
Status returns runtime status of the FakeRuntimeService.
func (*FakeRuntimeService) StopContainer ¶
func (r *FakeRuntimeService) StopContainer(_ context.Context, containerID string, timeout int64) error
StopContainer emulates stop of a container in the FakeRuntimeService.
func (*FakeRuntimeService) StopPodSandbox ¶
func (r *FakeRuntimeService) StopPodSandbox(_ context.Context, podSandboxID string) error
StopPodSandbox emulates the stop of pod sandbox in the FakeRuntimeService.
func (*FakeRuntimeService) UpdateContainerResources ¶
func (r *FakeRuntimeService) UpdateContainerResources(context.Context, string, *runtimeapi.ContainerResources) error
UpdateContainerResources returns the container resource in the FakeRuntimeService.
func (*FakeRuntimeService) UpdateRuntimeConfig ¶
func (r *FakeRuntimeService) UpdateRuntimeConfig(_ context.Context, runtimeCOnfig *runtimeapi.RuntimeConfig) error
UpdateRuntimeConfig emulates the update of a runtime config for the FakeRuntimeService.
func (*FakeRuntimeService) Version ¶
func (r *FakeRuntimeService) Version(_ context.Context, apiVersion string) (*runtimeapi.VersionResponse, error)
Version returns version information from the FakeRuntimeService.