Documentation ¶
Index ¶
- Constants
- func NewFakeCache(runtime container.Runtime) container.Cache
- func NewFakeRuntimeCache(getter podsGetter) RuntimeCache
- type FakeContainerCommandRunner
- type FakeDirectStreamingRuntime
- func (f *FakeDirectStreamingRuntime) AttachContainer(containerID ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, ...) error
- func (f *FakeDirectStreamingRuntime) ExecInContainer(containerID ContainerID, cmd []string, stdin io.Reader, ...) error
- func (f *FakeDirectStreamingRuntime) PortForward(pod *Pod, port int32, stream io.ReadWriteCloser) error
- type FakeIndirectStreamingRuntime
- func (f *FakeIndirectStreamingRuntime) GetAttach(id ContainerID, stdin, stdout, stderr, tty bool) (*url.URL, error)
- func (f *FakeIndirectStreamingRuntime) GetExec(id ContainerID, cmd []string, stdin, stdout, stderr, tty bool) (*url.URL, error)
- func (f *FakeIndirectStreamingRuntime) GetPortForward(podName, podNamespace string, podUID types.UID, ports []int32) (*url.URL, error)
- type FakeOS
- func (FakeOS) Chmod(path string, perm os.FileMode) error
- func (FakeOS) Chtimes(path string, atime time.Time, mtime time.Time) error
- func (FakeOS) Create(path string) (*os.File, error)
- func (f *FakeOS) Glob(pattern string) ([]string, error)
- func (f *FakeOS) Hostname() (name string, err error)
- func (f *FakeOS) MkdirAll(path string, perm os.FileMode) error
- func (FakeOS) Pipe() (r *os.File, w *os.File, err error)
- func (f *FakeOS) ReadDir(dirname string) ([]os.FileInfo, error)
- func (f *FakeOS) Remove(path string) error
- func (f *FakeOS) RemoveAll(path string) error
- func (f FakeOS) Stat(path string) (os.FileInfo, error)
- func (f *FakeOS) Symlink(oldname string, newname string) error
- type FakePod
- type FakeRuntime
- func (f *FakeRuntime) APIVersion() (Version, error)
- func (f *FakeRuntime) AssertCalls(calls []string) error
- func (f *FakeRuntime) AssertKilledContainers(containers []string) error
- func (f *FakeRuntime) AssertKilledPods(pods []string) error
- func (f *FakeRuntime) AssertStartedContainers(containers []string) error
- func (f *FakeRuntime) AssertStartedPods(pods []string) error
- func (f *FakeRuntime) ClearCalls()
- func (f *FakeRuntime) DeleteContainer(containerID ContainerID) error
- func (f *FakeRuntime) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool) error
- func (f *FakeRuntime) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, ...) (err error)
- func (f *FakeRuntime) GetImageRef(image ImageSpec) (string, error)
- func (f *FakeRuntime) GetNetNS(containerID ContainerID) (string, error)
- func (f *FakeRuntime) GetPodContainerID(pod *Pod) (ContainerID, error)
- func (f *FakeRuntime) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error)
- func (f *FakeRuntime) GetPods(all bool) ([]*Pod, error)
- func (f *FakeRuntime) ImageStats() (*ImageStats, error)
- func (f *FakeRuntime) KillContainerInPod(container v1.Container, pod *v1.Pod) error
- func (f *FakeRuntime) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error
- func (f *FakeRuntime) ListImages() ([]Image, error)
- func (f *FakeRuntime) PullImage(image ImageSpec, pullSecrets []v1.Secret) (string, error)
- func (f *FakeRuntime) RemoveImage(image ImageSpec) error
- func (f *FakeRuntime) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error
- func (f *FakeRuntime) Status() (*RuntimeStatus, error)
- func (f *FakeRuntime) SyncPod(pod *v1.Pod, _ v1.PodStatus, _ *PodStatus, _ []v1.Secret, ...) (result PodSyncResult)
- func (f *FakeRuntime) Type() string
- func (f *FakeRuntime) UpdatePodCIDR(c string) error
- func (f *FakeRuntime) Version() (Version, error)
- type FakeRuntimeCache
- type FakeRuntimeHelper
- func (f *FakeRuntimeHelper) GeneratePodHostNameAndDomain(pod *v1.Pod) (string, string, error)
- func (f *FakeRuntimeHelper) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (*kubecontainer.RunContainerOptions, bool, error)
- func (f *FakeRuntimeHelper) GetClusterDNS(pod *v1.Pod) ([]string, []string, bool, error)
- func (f *FakeRuntimeHelper) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
- func (f *FakeRuntimeHelper) GetPodCgroupParent(pod *v1.Pod) string
- func (f *FakeRuntimeHelper) GetPodDir(podUID kubetypes.UID) string
- type FakeVersion
- type Mock
- func (r *Mock) APIVersion() (Version, error)
- func (r *Mock) AttachContainer(containerID ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, ...) error
- func (r *Mock) DeleteContainer(containerID ContainerID) error
- func (r *Mock) ExecInContainer(containerID ContainerID, cmd []string, stdin io.Reader, ...) error
- func (r *Mock) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool) error
- func (r *Mock) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, ...) (err error)
- func (r *Mock) GetImageRef(image ImageSpec) (string, error)
- func (r *Mock) GetNetNS(containerID ContainerID) (string, error)
- func (r *Mock) GetPodContainerID(pod *Pod) (ContainerID, error)
- func (r *Mock) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error)
- func (r *Mock) GetPods(all bool) ([]*Pod, error)
- func (r *Mock) ImageStats() (*ImageStats, error)
- func (r *Mock) KillContainerInPod(container v1.Container, pod *v1.Pod) error
- func (r *Mock) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error
- func (r *Mock) ListImages() ([]Image, error)
- func (r *Mock) PortForward(pod *Pod, port uint16, stream io.ReadWriteCloser) error
- func (r *Mock) PullImage(image ImageSpec, pullSecrets []v1.Secret) (string, error)
- func (r *Mock) RemoveImage(image ImageSpec) error
- func (r *Mock) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error
- func (r *Mock) Start() error
- func (r *Mock) Status() (*RuntimeStatus, error)
- func (r *Mock) SyncPod(pod *v1.Pod, apiStatus v1.PodStatus, status *PodStatus, secrets []v1.Secret, ...) PodSyncResult
- func (r *Mock) Type() string
- func (r *Mock) UpdatePodCIDR(c string) error
- func (r *Mock) Version() (Version, error)
- type MockFileInfo
Constants ¶
View Source
const FakeHost = "localhost:12345"
Variables ¶
This section is empty.
Functions ¶
func NewFakeRuntimeCache ¶
func NewFakeRuntimeCache(getter podsGetter) RuntimeCache
Types ¶
type FakeContainerCommandRunner ¶
type FakeContainerCommandRunner struct { // what to return Stdout string Err error // actual values when invoked ContainerID ContainerID Cmd []string }
func (*FakeContainerCommandRunner) RunInContainer ¶
type FakeDirectStreamingRuntime ¶
type FakeDirectStreamingRuntime struct { *FakeRuntime // Arguments to streaming method calls. Args struct { // Attach / Exec args ContainerID ContainerID Cmd []string Stdin io.Reader Stdout io.WriteCloser Stderr io.WriteCloser TTY bool // Port-forward args Pod *Pod Port int32 Stream io.ReadWriteCloser } }
func (*FakeDirectStreamingRuntime) AttachContainer ¶
func (f *FakeDirectStreamingRuntime) AttachContainer(containerID ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) error
func (*FakeDirectStreamingRuntime) ExecInContainer ¶
func (*FakeDirectStreamingRuntime) PortForward ¶
func (f *FakeDirectStreamingRuntime) PortForward(pod *Pod, port int32, stream io.ReadWriteCloser) error
type FakeIndirectStreamingRuntime ¶
type FakeIndirectStreamingRuntime struct {
*FakeRuntime
}
func (*FakeIndirectStreamingRuntime) GetAttach ¶
func (f *FakeIndirectStreamingRuntime) GetAttach(id ContainerID, stdin, stdout, stderr, tty bool) (*url.URL, error)
func (*FakeIndirectStreamingRuntime) GetPortForward ¶
type FakeOS ¶
type FakeOS struct { StatFn func(string) (os.FileInfo, error) ReadDirFn func(string) ([]os.FileInfo, error) MkdirAllFn func(string, os.FileMode) error SymlinkFn func(string, string) error HostName string Removes []string Files map[string][]*os.FileInfo }
FakeOS mocks out certain OS calls to avoid perturbing the filesystem If a member of the form `*Fn` is set, that function will be called in place of the real call.
type FakeRuntime ¶
type FakeRuntime struct { sync.Mutex CalledFunctions []string PodList []*FakePod AllPodList []*FakePod ImageList []Image APIPodStatus v1.PodStatus PodStatus PodStatus StartedPods []string KilledPods []string StartedContainers []string KilledContainers []string RuntimeStatus *RuntimeStatus VersionInfo string APIVersionInfo string RuntimeType string Err error InspectErr error StatusErr error }
FakeRuntime is a fake container runtime for testing.
func (*FakeRuntime) APIVersion ¶
func (f *FakeRuntime) APIVersion() (Version, error)
func (*FakeRuntime) AssertCalls ¶
func (f *FakeRuntime) AssertCalls(calls []string) error
AssertCalls test if the invoked functions are as expected.
func (*FakeRuntime) AssertKilledContainers ¶
func (f *FakeRuntime) AssertKilledContainers(containers []string) error
func (*FakeRuntime) AssertKilledPods ¶
func (f *FakeRuntime) AssertKilledPods(pods []string) error
func (*FakeRuntime) AssertStartedContainers ¶
func (f *FakeRuntime) AssertStartedContainers(containers []string) error
func (*FakeRuntime) AssertStartedPods ¶
func (f *FakeRuntime) AssertStartedPods(pods []string) error
func (*FakeRuntime) ClearCalls ¶
func (f *FakeRuntime) ClearCalls()
ClearCalls resets the FakeRuntime to the initial state.
func (*FakeRuntime) DeleteContainer ¶
func (f *FakeRuntime) DeleteContainer(containerID ContainerID) error
func (*FakeRuntime) GarbageCollect ¶
func (f *FakeRuntime) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool) error
func (*FakeRuntime) GetContainerLogs ¶
func (f *FakeRuntime) GetContainerLogs(pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error)
func (*FakeRuntime) GetImageRef ¶
func (f *FakeRuntime) GetImageRef(image ImageSpec) (string, error)
func (*FakeRuntime) GetNetNS ¶
func (f *FakeRuntime) GetNetNS(containerID ContainerID) (string, error)
func (*FakeRuntime) GetPodContainerID ¶
func (f *FakeRuntime) GetPodContainerID(pod *Pod) (ContainerID, error)
func (*FakeRuntime) GetPodStatus ¶
func (f *FakeRuntime) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error)
func (*FakeRuntime) GetPods ¶
func (f *FakeRuntime) GetPods(all bool) ([]*Pod, error)
func (*FakeRuntime) ImageStats ¶
func (f *FakeRuntime) ImageStats() (*ImageStats, error)
func (*FakeRuntime) KillContainerInPod ¶
func (*FakeRuntime) KillPod ¶
func (f *FakeRuntime) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error
func (*FakeRuntime) ListImages ¶
func (f *FakeRuntime) ListImages() ([]Image, error)
func (*FakeRuntime) PullImage ¶
func (f *FakeRuntime) PullImage(image ImageSpec, pullSecrets []v1.Secret) (string, error)
func (*FakeRuntime) RemoveImage ¶
func (f *FakeRuntime) RemoveImage(image ImageSpec) error
func (*FakeRuntime) RunContainerInPod ¶
func (f *FakeRuntime) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error
func (*FakeRuntime) Status ¶
func (f *FakeRuntime) Status() (*RuntimeStatus, error)
func (*FakeRuntime) SyncPod ¶
func (f *FakeRuntime) SyncPod(pod *v1.Pod, _ v1.PodStatus, _ *PodStatus, _ []v1.Secret, backOff *flowcontrol.Backoff) (result PodSyncResult)
func (*FakeRuntime) Type ¶
func (f *FakeRuntime) Type() string
func (*FakeRuntime) UpdatePodCIDR ¶
func (f *FakeRuntime) UpdatePodCIDR(c string) error
UpdatePodCIDR fulfills the cri interface.
func (*FakeRuntime) Version ¶
func (f *FakeRuntime) Version() (Version, error)
type FakeRuntimeCache ¶
type FakeRuntimeCache struct {
// contains filtered or unexported fields
}
func (*FakeRuntimeCache) ForceUpdateIfOlder ¶
func (f *FakeRuntimeCache) ForceUpdateIfOlder(time.Time) error
func (*FakeRuntimeCache) GetPods ¶
func (f *FakeRuntimeCache) GetPods() ([]*Pod, error)
type FakeRuntimeHelper ¶
type FakeRuntimeHelper struct { DNSServers []string DNSSearches []string HostName string HostDomain string PodContainerDir string Err error }
FakeRuntimeHelper implements RuntimeHelper interfaces for testing purposes.
func (*FakeRuntimeHelper) GeneratePodHostNameAndDomain ¶
This is not used by docker runtime.
func (*FakeRuntimeHelper) GenerateRunContainerOptions ¶
func (f *FakeRuntimeHelper) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (*kubecontainer.RunContainerOptions, bool, error)
func (*FakeRuntimeHelper) GetClusterDNS ¶
func (*FakeRuntimeHelper) GetExtraSupplementalGroupsForPod ¶
func (f *FakeRuntimeHelper) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64
func (*FakeRuntimeHelper) GetPodCgroupParent ¶
func (f *FakeRuntimeHelper) GetPodCgroupParent(pod *v1.Pod) string
type FakeVersion ¶
type FakeVersion struct {
Version string
}
func (*FakeVersion) String ¶
func (fv *FakeVersion) String() string
type Mock ¶
func (*Mock) APIVersion ¶
func (*Mock) AttachContainer ¶
func (*Mock) DeleteContainer ¶
func (*Mock) ExecInContainer ¶
func (*Mock) GarbageCollect ¶
func (*Mock) GetContainerLogs ¶
func (*Mock) GetImageRef ¶
func (*Mock) GetPodContainerID ¶
func (*Mock) GetPodStatus ¶
func (*Mock) ImageStats ¶
func (*Mock) KillContainerInPod ¶
func (*Mock) ListImages ¶
func (*Mock) PortForward ¶
func (r *Mock) PortForward(pod *Pod, port uint16, stream io.ReadWriteCloser) error
func (*Mock) RemoveImage ¶
func (*Mock) RunContainerInPod ¶
func (*Mock) UpdatePodCIDR ¶
UpdatePodCIDR fulfills the cri interface.
type MockFileInfo ¶
type MockFileInfo struct {
// contains filtered or unexported fields
}
Mock of FileInfo interface
func NewMockFileInfo ¶
func NewMockFileInfo(ctrl *gomock.Controller) *MockFileInfo
func (*MockFileInfo) EXPECT ¶
func (_m *MockFileInfo) EXPECT() *_MockFileInfoRecorder
func (*MockFileInfo) IsDir ¶
func (_m *MockFileInfo) IsDir() bool
func (*MockFileInfo) ModTime ¶
func (_m *MockFileInfo) ModTime() time.Time
func (*MockFileInfo) Mode ¶
func (_m *MockFileInfo) Mode() os.FileMode
func (*MockFileInfo) Name ¶
func (_m *MockFileInfo) Name() string
func (*MockFileInfo) Size ¶
func (_m *MockFileInfo) Size() int64
func (*MockFileInfo) Sys ¶
func (_m *MockFileInfo) Sys() interface{}
Click to show internal directories.
Click to hide internal directories.