kubernetes: k8s.io/kubernetes/pkg/kubelet/container/testing Index | Files

package testing

import "k8s.io/kubernetes/pkg/kubelet/container/testing"

Code generated by mockery v1.0.0

Index

Package Files

fake_cache.go fake_runtime.go fake_runtime_helper.go mock_runtime_cache.go mockfileinfo.go os.go runtime_mock.go

Constants

const FakeHost = "localhost:12345"

func NewFakeCache Uses

func NewFakeCache(runtime container.Runtime) container.Cache

func NewFakeRuntimeCache Uses

func NewFakeRuntimeCache(getter podsGetter) RuntimeCache

type FakeContainerCommandRunner Uses

type FakeContainerCommandRunner struct {
    // what to return
    Stdout string
    Err    error

    // actual values when invoked
    ContainerID ContainerID
    Cmd         []string
}

func (*FakeContainerCommandRunner) RunInContainer Uses

func (f *FakeContainerCommandRunner) RunInContainer(containerID ContainerID, cmd []string, timeout time.Duration) ([]byte, error)

type FakeOS Uses

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.

func NewFakeOS Uses

func NewFakeOS() *FakeOS

func (FakeOS) Chmod Uses

func (FakeOS) Chmod(path string, perm os.FileMode) error

Chmod is a fake call that returns nil.

func (FakeOS) Chtimes Uses

func (FakeOS) Chtimes(path string, atime time.Time, mtime time.Time) error

Chtimes is a fake call that returns nil.

func (FakeOS) Create Uses

func (FakeOS) Create(path string) (*os.File, error)

Create is a fake call that returns nil.

func (*FakeOS) Glob Uses

func (f *FakeOS) Glob(pattern string) ([]string, error)

Glob is a fake call that returns nil.

func (*FakeOS) Hostname Uses

func (f *FakeOS) Hostname() (name string, err error)

Hostname is a fake call that returns nil.

func (*FakeOS) MkdirAll Uses

func (f *FakeOS) MkdirAll(path string, perm os.FileMode) error

Mkdir is a fake call that just returns nil.

func (FakeOS) Pipe Uses

func (FakeOS) Pipe() (r *os.File, w *os.File, err error)

Pipe is a fake call that returns nil.

func (*FakeOS) ReadDir Uses

func (f *FakeOS) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir is a fake call that returns the files under the directory.

func (*FakeOS) Remove Uses

func (f *FakeOS) Remove(path string) error

Remove is a fake call that returns nil.

func (*FakeOS) RemoveAll Uses

func (f *FakeOS) RemoveAll(path string) error

RemoveAll is a fake call that just returns nil.

func (FakeOS) Stat Uses

func (f FakeOS) Stat(path string) (os.FileInfo, error)

Stat is a fake that returns an error

func (f *FakeOS) Symlink(oldname string, newname string) error

Symlink is a fake call that just returns nil.

type FakePod Uses

type FakePod struct {
    Pod       *Pod
    NetnsPath string
}

type FakeRuntime Uses

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 Uses

func (f *FakeRuntime) APIVersion() (Version, error)

func (*FakeRuntime) AssertCalls Uses

func (f *FakeRuntime) AssertCalls(calls []string) error

AssertCalls test if the invoked functions are as expected.

func (*FakeRuntime) AssertKilledContainers Uses

func (f *FakeRuntime) AssertKilledContainers(containers []string) error

func (*FakeRuntime) AssertKilledPods Uses

func (f *FakeRuntime) AssertKilledPods(pods []string) error

func (*FakeRuntime) AssertStartedContainers Uses

func (f *FakeRuntime) AssertStartedContainers(containers []string) error

func (*FakeRuntime) AssertStartedPods Uses

func (f *FakeRuntime) AssertStartedPods(pods []string) error

func (*FakeRuntime) ClearCalls Uses

func (f *FakeRuntime) ClearCalls()

ClearCalls resets the FakeRuntime to the initial state.

func (*FakeRuntime) DeleteContainer Uses

func (f *FakeRuntime) DeleteContainer(containerID ContainerID) error

func (*FakeRuntime) GarbageCollect Uses

func (f *FakeRuntime) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool, evictNonDeletedPods bool) error

func (*FakeRuntime) GetContainerLogs Uses

func (f *FakeRuntime) GetContainerLogs(_ context.Context, pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error)

func (*FakeRuntime) GetImageRef Uses

func (f *FakeRuntime) GetImageRef(image ImageSpec) (string, error)

func (*FakeRuntime) GetPodStatus Uses

func (f *FakeRuntime) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error)

func (*FakeRuntime) GetPods Uses

func (f *FakeRuntime) GetPods(all bool) ([]*Pod, error)

func (*FakeRuntime) ImageStats Uses

func (f *FakeRuntime) ImageStats() (*ImageStats, error)

func (*FakeRuntime) KillContainerInPod Uses

func (f *FakeRuntime) KillContainerInPod(container v1.Container, pod *v1.Pod) error

func (*FakeRuntime) KillPod Uses

func (f *FakeRuntime) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error

func (*FakeRuntime) ListImages Uses

func (f *FakeRuntime) ListImages() ([]Image, error)

func (*FakeRuntime) PullImage Uses

func (f *FakeRuntime) PullImage(image ImageSpec, pullSecrets []v1.Secret, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)

func (*FakeRuntime) RemoveImage Uses

func (f *FakeRuntime) RemoveImage(image ImageSpec) error

func (*FakeRuntime) RunContainerInPod Uses

func (f *FakeRuntime) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error

func (*FakeRuntime) Status Uses

func (f *FakeRuntime) Status() (*RuntimeStatus, error)

func (*FakeRuntime) SyncPod Uses

func (f *FakeRuntime) SyncPod(pod *v1.Pod, _ *PodStatus, _ []v1.Secret, backOff *flowcontrol.Backoff) (result PodSyncResult)

func (*FakeRuntime) Type Uses

func (f *FakeRuntime) Type() string

func (*FakeRuntime) UpdatePodCIDR Uses

func (f *FakeRuntime) UpdatePodCIDR(c string) error

UpdatePodCIDR fulfills the cri interface.

func (*FakeRuntime) Version Uses

func (f *FakeRuntime) Version() (Version, error)

type FakeRuntimeCache Uses

type FakeRuntimeCache struct {
    // contains filtered or unexported fields
}

func (*FakeRuntimeCache) ForceUpdateIfOlder Uses

func (f *FakeRuntimeCache) ForceUpdateIfOlder(time.Time) error

func (*FakeRuntimeCache) GetPods Uses

func (f *FakeRuntimeCache) GetPods() ([]*Pod, error)

type FakeRuntimeHelper Uses

type FakeRuntimeHelper struct {
    DNSServers      []string
    DNSSearches     []string
    DNSOptions      []string
    HostName        string
    HostDomain      string
    PodContainerDir string
    Err             error
}

FakeRuntimeHelper implements RuntimeHelper interfaces for testing purposes.

func (*FakeRuntimeHelper) GeneratePodHostNameAndDomain Uses

func (f *FakeRuntimeHelper) GeneratePodHostNameAndDomain(pod *v1.Pod) (string, string, error)

This is not used by docker runtime.

func (*FakeRuntimeHelper) GenerateRunContainerOptions Uses

func (f *FakeRuntimeHelper) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Container, podIP string) (*kubecontainer.RunContainerOptions, func(), error)

func (*FakeRuntimeHelper) GetExtraSupplementalGroupsForPod Uses

func (f *FakeRuntimeHelper) GetExtraSupplementalGroupsForPod(pod *v1.Pod) []int64

func (*FakeRuntimeHelper) GetPodCgroupParent Uses

func (f *FakeRuntimeHelper) GetPodCgroupParent(pod *v1.Pod) string

func (*FakeRuntimeHelper) GetPodDNS Uses

func (f *FakeRuntimeHelper) GetPodDNS(pod *v1.Pod) (*runtimeapi.DNSConfig, error)

func (*FakeRuntimeHelper) GetPodDir Uses

func (f *FakeRuntimeHelper) GetPodDir(podUID kubetypes.UID) string

type FakeStreamingRuntime Uses

type FakeStreamingRuntime struct {
    *FakeRuntime
}

func (*FakeStreamingRuntime) GetAttach Uses

func (f *FakeStreamingRuntime) GetAttach(id ContainerID, stdin, stdout, stderr, tty bool) (*url.URL, error)

func (*FakeStreamingRuntime) GetExec Uses

func (f *FakeStreamingRuntime) GetExec(id ContainerID, cmd []string, stdin, stdout, stderr, tty bool) (*url.URL, error)

func (*FakeStreamingRuntime) GetPortForward Uses

func (f *FakeStreamingRuntime) GetPortForward(podName, podNamespace string, podUID types.UID, ports []int32) (*url.URL, error)

type FakeVersion Uses

type FakeVersion struct {
    Version string
}

func (*FakeVersion) Compare Uses

func (fv *FakeVersion) Compare(other string) (int, error)

func (*FakeVersion) String Uses

func (fv *FakeVersion) String() string

type Mock Uses

type Mock struct {
    mock.Mock
}

func (*Mock) APIVersion Uses

func (r *Mock) APIVersion() (Version, error)

func (*Mock) AttachContainer Uses

func (r *Mock) AttachContainer(containerID ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error

func (*Mock) DeleteContainer Uses

func (r *Mock) DeleteContainer(containerID ContainerID) error

func (*Mock) ExecInContainer Uses

func (r *Mock) ExecInContainer(containerID ContainerID, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error

func (*Mock) GarbageCollect Uses

func (r *Mock) GarbageCollect(gcPolicy ContainerGCPolicy, ready bool, evictNonDeletedPods bool) error

func (*Mock) GetContainerLogs Uses

func (r *Mock) GetContainerLogs(_ context.Context, pod *v1.Pod, containerID ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error)

func (*Mock) GetImageRef Uses

func (r *Mock) GetImageRef(image ImageSpec) (string, error)

func (*Mock) GetPodStatus Uses

func (r *Mock) GetPodStatus(uid types.UID, name, namespace string) (*PodStatus, error)

func (*Mock) GetPods Uses

func (r *Mock) GetPods(all bool) ([]*Pod, error)

func (*Mock) ImageStats Uses

func (r *Mock) ImageStats() (*ImageStats, error)

func (*Mock) KillContainerInPod Uses

func (r *Mock) KillContainerInPod(container v1.Container, pod *v1.Pod) error

func (*Mock) KillPod Uses

func (r *Mock) KillPod(pod *v1.Pod, runningPod Pod, gracePeriodOverride *int64) error

func (*Mock) ListImages Uses

func (r *Mock) ListImages() ([]Image, error)

func (*Mock) PortForward Uses

func (r *Mock) PortForward(pod *Pod, port uint16, stream io.ReadWriteCloser) error

func (*Mock) PullImage Uses

func (r *Mock) PullImage(image ImageSpec, pullSecrets []v1.Secret, podSandboxConfig *runtimeapi.PodSandboxConfig) (string, error)

func (*Mock) RemoveImage Uses

func (r *Mock) RemoveImage(image ImageSpec) error

func (*Mock) RunContainerInPod Uses

func (r *Mock) RunContainerInPod(container v1.Container, pod *v1.Pod, volumeMap map[string]volume.VolumePlugin) error

func (*Mock) Start Uses

func (r *Mock) Start() error

func (*Mock) Status Uses

func (r *Mock) Status() (*RuntimeStatus, error)

func (*Mock) SyncPod Uses

func (r *Mock) SyncPod(pod *v1.Pod, status *PodStatus, secrets []v1.Secret, backOff *flowcontrol.Backoff) PodSyncResult

func (*Mock) Type Uses

func (r *Mock) Type() string

func (*Mock) UpdatePodCIDR Uses

func (r *Mock) UpdatePodCIDR(c string) error

UpdatePodCIDR fulfills the cri interface.

func (*Mock) Version Uses

func (r *Mock) Version() (Version, error)

type MockFileInfo Uses

type MockFileInfo struct {
    // contains filtered or unexported fields
}

Mock of FileInfo interface

func NewMockFileInfo Uses

func NewMockFileInfo(ctrl *gomock.Controller) *MockFileInfo

func (*MockFileInfo) EXPECT Uses

func (_m *MockFileInfo) EXPECT() *_MockFileInfoRecorder

func (*MockFileInfo) IsDir Uses

func (_m *MockFileInfo) IsDir() bool

func (*MockFileInfo) ModTime Uses

func (_m *MockFileInfo) ModTime() time.Time

func (*MockFileInfo) Mode Uses

func (_m *MockFileInfo) Mode() os.FileMode

func (*MockFileInfo) Name Uses

func (_m *MockFileInfo) Name() string

func (*MockFileInfo) Size Uses

func (_m *MockFileInfo) Size() int64

func (*MockFileInfo) Sys Uses

func (_m *MockFileInfo) Sys() interface{}

type MockRuntimeCache Uses

type MockRuntimeCache struct {
    mock.Mock
}

MockRuntimeCache is an autogenerated mock type for the RuntimeCache type

func (*MockRuntimeCache) ForceUpdateIfOlder Uses

func (_m *MockRuntimeCache) ForceUpdateIfOlder(_a0 time.Time) error

ForceUpdateIfOlder provides a mock function with given fields: _a0

func (*MockRuntimeCache) GetPods Uses

func (_m *MockRuntimeCache) GetPods() ([]*container.Pod, error)

GetPods provides a mock function with given fields:

Package testing imports 18 packages (graph) and is imported by 227 packages. Updated 2019-04-02. Refresh now. Tools for package owners.