Documentation ¶
Overview ¶
TODO: credits (based on fake_image_service.go from k8s)
Index ¶
- Variables
- func BuildContainerName(metadata *runtimeapi.ContainerMetadata, sandboxID string) string
- func BuildSandboxName(metadata *runtimeapi.PodSandboxMetadata) string
- type FakeContainer
- type FakeCriServer
- type FakeImageServer
- func (r *FakeImageServer) ImageFsInfo(ctx context.Context, in *runtimeapi.ImageFsInfoRequest) (*runtimeapi.ImageFsInfoResponse, error)
- func (r *FakeImageServer) ImageStatus(ctx context.Context, in *runtimeapi.ImageStatusRequest) (*runtimeapi.ImageStatusResponse, error)
- func (r *FakeImageServer) ListImages(ctx context.Context, in *runtimeapi.ListImagesRequest) (*runtimeapi.ListImagesResponse, error)
- func (r *FakeImageServer) PullImage(ctx context.Context, in *runtimeapi.PullImageRequest) (*runtimeapi.PullImageResponse, error)
- func (r *FakeImageServer) RemoveImage(ctx context.Context, in *runtimeapi.RemoveImageRequest) (*runtimeapi.RemoveImageResponse, error)
- func (r *FakeImageServer) SetFakeImageSize(size uint64)
- func (r *FakeImageServer) SetFakeImages(images []string)
- type FakePodSandbox
- type FakeRuntimeServer
- func (r *FakeRuntimeServer) Attach(ctx context.Context, in *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
- func (r *FakeRuntimeServer) ContainerStats(ctx context.Context, in *runtimeapi.ContainerStatsRequest) (*runtimeapi.ContainerStatsResponse, error)
- func (r *FakeRuntimeServer) ContainerStatus(ctx context.Context, in *runtimeapi.ContainerStatusRequest) (*runtimeapi.ContainerStatusResponse, error)
- func (r *FakeRuntimeServer) CreateContainer(ctx context.Context, in *runtimeapi.CreateContainerRequest) (*runtimeapi.CreateContainerResponse, error)
- func (r *FakeRuntimeServer) Exec(ctx context.Context, in *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
- func (r *FakeRuntimeServer) ExecSync(ctx context.Context, in *runtimeapi.ExecSyncRequest) (*runtimeapi.ExecSyncResponse, error)
- func (r *FakeRuntimeServer) ListContainerStats(ctx context.Context, in *runtimeapi.ListContainerStatsRequest) (*runtimeapi.ListContainerStatsResponse, error)
- func (r *FakeRuntimeServer) ListContainers(ctx context.Context, in *runtimeapi.ListContainersRequest) (*runtimeapi.ListContainersResponse, error)
- func (r *FakeRuntimeServer) ListPodSandbox(ctx context.Context, in *runtimeapi.ListPodSandboxRequest) (*runtimeapi.ListPodSandboxResponse, error)
- func (r *FakeRuntimeServer) PodSandboxStatus(ctx context.Context, in *runtimeapi.PodSandboxStatusRequest) (*runtimeapi.PodSandboxStatusResponse, error)
- func (r *FakeRuntimeServer) PortForward(ctx context.Context, in *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
- func (r *FakeRuntimeServer) RemoveContainer(ctx context.Context, in *runtimeapi.RemoveContainerRequest) (*runtimeapi.RemoveContainerResponse, error)
- func (r *FakeRuntimeServer) RemovePodSandbox(ctx context.Context, in *runtimeapi.RemovePodSandboxRequest) (*runtimeapi.RemovePodSandboxResponse, error)
- func (r *FakeRuntimeServer) RunPodSandbox(ctx context.Context, in *runtimeapi.RunPodSandboxRequest) (*runtimeapi.RunPodSandboxResponse, error)
- func (r *FakeRuntimeServer) SetFakeContainers(containers []*FakeContainer)
- func (r *FakeRuntimeServer) SetFakeSandboxes(sandboxes []*FakePodSandbox)
- func (r *FakeRuntimeServer) StartContainer(ctx context.Context, in *runtimeapi.StartContainerRequest) (*runtimeapi.StartContainerResponse, error)
- func (r *FakeRuntimeServer) Status(ctx context.Context, in *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error)
- func (r *FakeRuntimeServer) StopContainer(ctx context.Context, in *runtimeapi.StopContainerRequest) (*runtimeapi.StopContainerResponse, error)
- func (r *FakeRuntimeServer) StopPodSandbox(ctx context.Context, in *runtimeapi.StopPodSandboxRequest) (*runtimeapi.StopPodSandboxResponse, error)
- func (r *FakeRuntimeServer) UpdateRuntimeConfig(ctx context.Context, in *runtimeapi.UpdateRuntimeConfigRequest) (*runtimeapi.UpdateRuntimeConfigResponse, error)
- func (r *FakeRuntimeServer) Version(ctx context.Context, in *runtimeapi.VersionRequest) (*runtimeapi.VersionResponse, error)
- type Journal
- type PrefixJournal
- type SimpleJournal
Constants ¶
This section is empty.
Variables ¶
var ( FakeRuntimeName = "fakeRuntime" FakePodSandboxIP = "192.168.192.168" )
Functions ¶
func BuildContainerName ¶
func BuildContainerName(metadata *runtimeapi.ContainerMetadata, sandboxID string) string
func BuildSandboxName ¶
func BuildSandboxName(metadata *runtimeapi.PodSandboxMetadata) string
Types ¶
type FakeContainer ¶
type FakeContainer struct { // ContainerStatus contains the runtime information for a container. runtimeapi.ContainerStatus // the sandbox id of this container SandboxID string }
type FakeCriServer ¶
type FakeCriServer struct { *FakeRuntimeServer *FakeImageServer // contains filtered or unexported fields }
func NewFakeCriServer ¶
func NewFakeCriServer(journal Journal) *FakeCriServer
func (*FakeCriServer) Serve ¶
func (s *FakeCriServer) Serve(addr string, readyCh chan struct{}) error
func (*FakeCriServer) Stop ¶
func (s *FakeCriServer) Stop()
type FakeImageServer ¶
type FakeImageServer struct { sync.Mutex FakeImageSize uint64 Images map[string]*runtimeapi.Image // contains filtered or unexported fields }
func NewFakeImageServer ¶
func NewFakeImageServer(journal Journal) *FakeImageServer
func (*FakeImageServer) ImageFsInfo ¶ added in v0.8.0
func (r *FakeImageServer) ImageFsInfo(ctx context.Context, in *runtimeapi.ImageFsInfoRequest) (*runtimeapi.ImageFsInfoResponse, error)
func (*FakeImageServer) ImageStatus ¶
func (r *FakeImageServer) ImageStatus(ctx context.Context, in *runtimeapi.ImageStatusRequest) (*runtimeapi.ImageStatusResponse, error)
func (*FakeImageServer) ListImages ¶
func (r *FakeImageServer) ListImages(ctx context.Context, in *runtimeapi.ListImagesRequest) (*runtimeapi.ListImagesResponse, error)
func (*FakeImageServer) PullImage ¶
func (r *FakeImageServer) PullImage(ctx context.Context, in *runtimeapi.PullImageRequest) (*runtimeapi.PullImageResponse, error)
func (*FakeImageServer) RemoveImage ¶
func (r *FakeImageServer) RemoveImage(ctx context.Context, in *runtimeapi.RemoveImageRequest) (*runtimeapi.RemoveImageResponse, error)
func (*FakeImageServer) SetFakeImageSize ¶
func (r *FakeImageServer) SetFakeImageSize(size uint64)
func (*FakeImageServer) SetFakeImages ¶
func (r *FakeImageServer) SetFakeImages(images []string)
type FakePodSandbox ¶
type FakePodSandbox struct { // PodSandboxStatus contains the runtime information for a sandbox. runtimeapi.PodSandboxStatus }
type FakeRuntimeServer ¶
type FakeRuntimeServer struct { sync.Mutex CurrentTime int64 FakeStatus *runtimeapi.RuntimeStatus Containers map[string]*FakeContainer Sandboxes map[string]*FakePodSandbox // contains filtered or unexported fields }
func NewFakeRuntimeServer ¶
func NewFakeRuntimeServer(journal Journal) *FakeRuntimeServer
func (*FakeRuntimeServer) Attach ¶
func (r *FakeRuntimeServer) Attach(ctx context.Context, in *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error)
func (*FakeRuntimeServer) ContainerStats ¶ added in v0.8.0
func (r *FakeRuntimeServer) ContainerStats(ctx context.Context, in *runtimeapi.ContainerStatsRequest) (*runtimeapi.ContainerStatsResponse, error)
func (*FakeRuntimeServer) ContainerStatus ¶
func (r *FakeRuntimeServer) ContainerStatus(ctx context.Context, in *runtimeapi.ContainerStatusRequest) (*runtimeapi.ContainerStatusResponse, error)
func (*FakeRuntimeServer) CreateContainer ¶
func (r *FakeRuntimeServer) CreateContainer(ctx context.Context, in *runtimeapi.CreateContainerRequest) (*runtimeapi.CreateContainerResponse, error)
func (*FakeRuntimeServer) Exec ¶
func (r *FakeRuntimeServer) Exec(ctx context.Context, in *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error)
func (*FakeRuntimeServer) ExecSync ¶
func (r *FakeRuntimeServer) ExecSync(ctx context.Context, in *runtimeapi.ExecSyncRequest) (*runtimeapi.ExecSyncResponse, error)
func (*FakeRuntimeServer) ListContainerStats ¶ added in v0.8.0
func (r *FakeRuntimeServer) ListContainerStats(ctx context.Context, in *runtimeapi.ListContainerStatsRequest) (*runtimeapi.ListContainerStatsResponse, error)
func (*FakeRuntimeServer) ListContainers ¶
func (r *FakeRuntimeServer) ListContainers(ctx context.Context, in *runtimeapi.ListContainersRequest) (*runtimeapi.ListContainersResponse, error)
func (*FakeRuntimeServer) ListPodSandbox ¶
func (r *FakeRuntimeServer) ListPodSandbox(ctx context.Context, in *runtimeapi.ListPodSandboxRequest) (*runtimeapi.ListPodSandboxResponse, error)
func (*FakeRuntimeServer) PodSandboxStatus ¶
func (r *FakeRuntimeServer) PodSandboxStatus(ctx context.Context, in *runtimeapi.PodSandboxStatusRequest) (*runtimeapi.PodSandboxStatusResponse, error)
func (*FakeRuntimeServer) PortForward ¶
func (r *FakeRuntimeServer) PortForward(ctx context.Context, in *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error)
func (*FakeRuntimeServer) RemoveContainer ¶
func (r *FakeRuntimeServer) RemoveContainer(ctx context.Context, in *runtimeapi.RemoveContainerRequest) (*runtimeapi.RemoveContainerResponse, error)
func (*FakeRuntimeServer) RemovePodSandbox ¶
func (r *FakeRuntimeServer) RemovePodSandbox(ctx context.Context, in *runtimeapi.RemovePodSandboxRequest) (*runtimeapi.RemovePodSandboxResponse, error)
func (*FakeRuntimeServer) RunPodSandbox ¶
func (r *FakeRuntimeServer) RunPodSandbox(ctx context.Context, in *runtimeapi.RunPodSandboxRequest) (*runtimeapi.RunPodSandboxResponse, error)
func (*FakeRuntimeServer) SetFakeContainers ¶
func (r *FakeRuntimeServer) SetFakeContainers(containers []*FakeContainer)
func (*FakeRuntimeServer) SetFakeSandboxes ¶
func (r *FakeRuntimeServer) SetFakeSandboxes(sandboxes []*FakePodSandbox)
func (*FakeRuntimeServer) StartContainer ¶
func (r *FakeRuntimeServer) StartContainer(ctx context.Context, in *runtimeapi.StartContainerRequest) (*runtimeapi.StartContainerResponse, error)
func (*FakeRuntimeServer) Status ¶
func (r *FakeRuntimeServer) Status(ctx context.Context, in *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error)
func (*FakeRuntimeServer) StopContainer ¶
func (r *FakeRuntimeServer) StopContainer(ctx context.Context, in *runtimeapi.StopContainerRequest) (*runtimeapi.StopContainerResponse, error)
func (*FakeRuntimeServer) StopPodSandbox ¶
func (r *FakeRuntimeServer) StopPodSandbox(ctx context.Context, in *runtimeapi.StopPodSandboxRequest) (*runtimeapi.StopPodSandboxResponse, error)
func (*FakeRuntimeServer) UpdateRuntimeConfig ¶
func (r *FakeRuntimeServer) UpdateRuntimeConfig(ctx context.Context, in *runtimeapi.UpdateRuntimeConfigRequest) (*runtimeapi.UpdateRuntimeConfigResponse, error)
func (*FakeRuntimeServer) Version ¶
func (r *FakeRuntimeServer) Version(ctx context.Context, in *runtimeapi.VersionRequest) (*runtimeapi.VersionResponse, error)
type Journal ¶
type Journal interface { // Record saves the specified item in the journal Record(item string) }
Journal records a series of events (items) represented as strings in a thread-safe way
type PrefixJournal ¶
type PrefixJournal struct {
// contains filtered or unexported fields
}
PrefixJournal is an implementation of Journal interface that prefixes every item passed to it with the specified prefix before passing it on to the underlying Journal
func NewPrefixJournal ¶
func NewPrefixJournal(journal Journal, prefix string) *PrefixJournal
NewPrefixJournal creates an instance of PrefixJournal with the specified underlying journal and prefix
func (*PrefixJournal) Record ¶
func (j *PrefixJournal) Record(item string)
Record implements Record method of Journal interface
type SimpleJournal ¶
SimpleJournal is an implementation of Journal that has methods for waiting for particular events and verifying journal contents
func NewSimpleJournal ¶
func NewSimpleJournal() *SimpleJournal
NewSimpleJournal creates an instance of SimpleJournal
func (*SimpleJournal) Record ¶
func (j *SimpleJournal) Record(item string)
Record implements Record method of Journal interface
func (*SimpleJournal) Verify ¶
func (j *SimpleJournal) Verify(expectedItems []string) error
Verify verifies that the current contents of the journal is expectedItems, returns nil if so or an error otherwise
func (*SimpleJournal) VerifyUnordered ¶
func (j *SimpleJournal) VerifyUnordered(expectedItems []string) error
VerifyUnordered verifies that the current contents of the journal contains the same items as expectedItems slice but in any order. It returns nil if so or an error otherwise