testing

package
v1.31.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 102

Documentation

Index

Constants

View Source
const FakeHost = "localhost:12345"

Variables

This section is empty.

Functions

func NewFakeCache

func NewFakeCache(runtime container.Runtime) container.Cache

func NewFakeReadyProvider added in v1.29.0

func NewFakeReadyProvider() kubecontainer.SourcesReadyProvider

NewFakeReadyProvider creates a FakeReadyProvider object

func NewFakeRuntimeCache

func NewFakeRuntimeCache(getter podsGetter) kubecontainer.RuntimeCache

Types

type FakeContainerCommandRunner added in v1.5.0

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

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

func (*FakeContainerCommandRunner) RunInContainer added in v1.5.0

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

type FakeOS

type FakeOS struct {
	StatFn     func(string) (os.FileInfo, error)
	ReadDirFn  func(string) ([]os.DirEntry, error)
	MkdirAllFn func(string, os.FileMode) error
	SymlinkFn  func(string, string) error
	GlobFn     func(string, string) bool
	HostName   string
	Removes    []string
	Files      map[string][]*os.FileInfo
	FilesLock  sync.RWMutex
}

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 (*FakeOS) Chmod added in v1.6.0

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

Chmod is a fake call that returns nil.

func (*FakeOS) Chtimes added in v1.3.0

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

Chtimes is a fake call that returns nil.

func (*FakeOS) Create added in v1.3.0

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

Create is a fake call that creates a virtual file and returns nil.

func (*FakeOS) Glob added in v1.5.0

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

Glob is a fake call that returns list of virtual files matching a pattern.

func (*FakeOS) Hostname added in v1.3.0

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

Hostname is a fake call that returns nil.

func (*FakeOS) MkdirAll added in v1.3.0

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

Mkdir is a fake call that just returns nil.

func (*FakeOS) Open added in v1.17.12

func (*FakeOS) Open(name string) (*os.File, error)

Open is a fake call that returns nil.

func (*FakeOS) OpenFile added in v1.17.12

func (*FakeOS) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)

OpenFile is a fake call that return nil.

func (*FakeOS) Pipe added in v1.3.0

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

Pipe is a fake call that returns nil.

func (*FakeOS) ReadDir added in v1.3.0

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

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

func (*FakeOS) Remove added in v1.3.0

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

Remove is a fake call that returns nil.

func (*FakeOS) RemoveAll added in v1.5.0

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

RemoveAll is a fake call that just returns nil.

func (*FakeOS) Rename added in v1.17.12

func (*FakeOS) Rename(oldpath, newpath string) error

Rename is a fake call that return nil.

func (*FakeOS) Stat added in v1.3.0

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 added in v1.3.0

type FakePod struct {
	Pod       *kubecontainer.Pod
	NetnsPath string
}

type FakeReadyProvider added in v1.29.0

type FakeReadyProvider struct {
	kubecontainer.SourcesReadyProvider
}

FakeReadyProvider implements a fake ready provider

func (*FakeReadyProvider) AllReady added in v1.29.0

func (frp *FakeReadyProvider) AllReady() bool

AllReady notifies caller that the Fake Provider is ready.

type FakeRuntime

type FakeRuntime struct {
	sync.Mutex
	CalledFunctions   []string
	PodList           []*FakePod
	AllPodList        []*FakePod
	ImageList         []kubecontainer.Image
	ImageFsStats      []*runtimeapi.FilesystemUsage
	ContainerFsStats  []*runtimeapi.FilesystemUsage
	APIPodStatus      v1.PodStatus
	PodStatus         kubecontainer.PodStatus
	StartedPods       []string
	KilledPods        []string
	StartedContainers []string
	KilledContainers  []string
	RuntimeStatus     *kubecontainer.RuntimeStatus
	VersionInfo       string
	APIVersionInfo    string
	RuntimeType       string
	Err               error
	InspectErr        error
	StatusErr         error
	// If BlockImagePulls is true, then all PullImage() calls will be blocked until
	// UnblockImagePulls() is called. This is used to simulate image pull latency
	// from container runtime.
	BlockImagePulls bool

	T TB
	// contains filtered or unexported fields
}

FakeRuntime is a fake container runtime for testing.

func (*FakeRuntime) APIVersion

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

func (*FakeRuntime) AssertCallCounts added in v1.27.0

func (f *FakeRuntime) AssertCallCounts(funcName string, expectedCount int) bool

AssertCallCounts checks if a certain call is called for a certain of numbers

func (*FakeRuntime) AssertCalls

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

AssertCalls test if the invoked functions are as expected.

func (*FakeRuntime) AssertKilledContainers

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

func (*FakeRuntime) AssertKilledPods

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

func (*FakeRuntime) AssertStartedContainers

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

func (*FakeRuntime) AssertStartedPods

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

func (*FakeRuntime) CheckpointContainer added in v1.25.0

func (f *FakeRuntime) CheckpointContainer(_ context.Context, options *runtimeapi.CheckpointContainerRequest) error

func (*FakeRuntime) DeleteContainer added in v1.4.0

func (f *FakeRuntime) DeleteContainer(_ context.Context, containerID kubecontainer.ContainerID) error

func (*FakeRuntime) GarbageCollect

func (f *FakeRuntime) GarbageCollect(_ context.Context, gcPolicy kubecontainer.GCPolicy, ready bool, evictNonDeletedPods bool) error

func (*FakeRuntime) GeneratePodStatus added in v1.26.0

func (f *FakeRuntime) GeneratePodStatus(event *runtimeapi.ContainerEventResponse) (*kubecontainer.PodStatus, error)

func (*FakeRuntime) GetContainerLogs

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

func (*FakeRuntime) GetImageRef added in v1.6.0

func (f *FakeRuntime) GetImageRef(_ context.Context, image kubecontainer.ImageSpec) (string, error)

func (*FakeRuntime) GetImageSize added in v1.30.0

func (f *FakeRuntime) GetImageSize(_ context.Context, image kubecontainer.ImageSpec) (uint64, error)

func (*FakeRuntime) GetPodStatus

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

func (*FakeRuntime) GetPods

func (f *FakeRuntime) GetPods(_ context.Context, all bool) ([]*kubecontainer.Pod, error)

func (*FakeRuntime) ImageFsInfo added in v1.29.0

ImageFsInfo returns a ImageFsInfoResponse given the DI injected values of ImageFsStats and ContainerFsStats.

func (*FakeRuntime) ImageStats added in v1.3.0

func (*FakeRuntime) KillContainerInPod

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

func (*FakeRuntime) KillPod

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

func (*FakeRuntime) ListImages

func (f *FakeRuntime) ListImages(_ context.Context) ([]kubecontainer.Image, error)

func (*FakeRuntime) ListMetricDescriptors added in v1.26.0

func (f *FakeRuntime) ListMetricDescriptors(_ context.Context) ([]*runtimeapi.MetricDescriptor, error)

func (*FakeRuntime) ListPodSandboxMetrics added in v1.26.0

func (f *FakeRuntime) ListPodSandboxMetrics(_ context.Context) ([]*runtimeapi.PodSandboxMetrics, error)

func (*FakeRuntime) PullImage

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

func (*FakeRuntime) RemoveImage

func (f *FakeRuntime) RemoveImage(_ context.Context, image kubecontainer.ImageSpec) error

func (*FakeRuntime) RunContainerInPod

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

func (*FakeRuntime) SetContainerFsStats added in v1.29.0

func (f *FakeRuntime) SetContainerFsStats(val []*runtimeapi.FilesystemUsage)

SetContainerFsStats sets the containerFsStats for dependency injection.

func (*FakeRuntime) SetImageFsStats added in v1.29.0

func (f *FakeRuntime) SetImageFsStats(val []*runtimeapi.FilesystemUsage)

SetImageFsStats sets the ImageFsStats for dependency injection.

func (*FakeRuntime) Status

func (*FakeRuntime) SyncPod

func (*FakeRuntime) Type

func (f *FakeRuntime) Type() string

func (*FakeRuntime) UnblockImagePulls added in v1.27.0

func (f *FakeRuntime) UnblockImagePulls(count int)

UnblockImagePulls unblocks a certain number of image pulls, if BlockImagePulls is true.

func (*FakeRuntime) UpdatePodCIDR added in v1.5.0

func (f *FakeRuntime) UpdatePodCIDR(_ context.Context, c string) error

UpdatePodCIDR fulfills the cri interface.

func (*FakeRuntime) Version

type FakeRuntimeCache

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

func (*FakeRuntimeCache) ForceUpdateIfOlder

func (f *FakeRuntimeCache) ForceUpdateIfOlder(context.Context, time.Time) error

func (*FakeRuntimeCache) GetPods

func (f *FakeRuntimeCache) GetPods(ctx context.Context) ([]*kubecontainer.Pod, error)

type FakeRuntimeHelper added in v1.6.0

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 added in v1.6.0

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

This is not used by docker runtime.

func (*FakeRuntimeHelper) GenerateRunContainerOptions added in v1.6.0

func (f *FakeRuntimeHelper) GenerateRunContainerOptions(_ context.Context, pod *v1.Pod, container *v1.Container, podIP string, podIPs []string) (*kubecontainer.RunContainerOptions, func(), error)

func (*FakeRuntimeHelper) GetExtraSupplementalGroupsForPod added in v1.6.0

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

func (*FakeRuntimeHelper) GetOrCreateUserNamespaceMappings added in v1.25.0

func (f *FakeRuntimeHelper) GetOrCreateUserNamespaceMappings(pod *v1.Pod, runtimeHandler string) (*runtimeapi.UserNamespace, error)

func (*FakeRuntimeHelper) GetPodCgroupParent added in v1.6.0

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

func (*FakeRuntimeHelper) GetPodDNS added in v1.9.0

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

func (*FakeRuntimeHelper) GetPodDir added in v1.6.0

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

func (*FakeRuntimeHelper) PrepareDynamicResources added in v1.27.0

func (f *FakeRuntimeHelper) PrepareDynamicResources(pod *v1.Pod) error

func (*FakeRuntimeHelper) UnprepareDynamicResources added in v1.27.0

func (f *FakeRuntimeHelper) UnprepareDynamicResources(pod *v1.Pod) error

type FakeStreamingRuntime added in v1.11.0

type FakeStreamingRuntime struct {
	*FakeRuntime
}

func (*FakeStreamingRuntime) GetAttach added in v1.11.0

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

func (*FakeStreamingRuntime) GetExec added in v1.11.0

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

func (*FakeStreamingRuntime) GetPortForward added in v1.11.0

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

type FakeVersion

type FakeVersion struct {
	Version string
}

func (*FakeVersion) Compare

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

func (*FakeVersion) String

func (fv *FakeVersion) String() string

type MockDirEntry added in v1.26.0

type MockDirEntry struct {
	mock.Mock
}

MockDirEntry is an autogenerated mock type for the DirEntry type

func NewMockDirEntry added in v1.26.0

func NewMockDirEntry(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDirEntry

NewMockDirEntry creates a new instance of MockDirEntry. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockDirEntry) EXPECT added in v1.26.0

func (_m *MockDirEntry) EXPECT() *MockDirEntry_Expecter

func (*MockDirEntry) Info added in v1.26.0

func (_m *MockDirEntry) Info() (fs.FileInfo, error)

Info provides a mock function with given fields:

func (*MockDirEntry) IsDir added in v1.26.0

func (_m *MockDirEntry) IsDir() bool

IsDir provides a mock function with given fields:

func (*MockDirEntry) Name added in v1.26.0

func (_m *MockDirEntry) Name() string

Name provides a mock function with given fields:

func (*MockDirEntry) Type added in v1.26.0

func (_m *MockDirEntry) Type() fs.FileMode

Type provides a mock function with given fields:

type MockDirEntry_Expecter added in v1.31.0

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

func (*MockDirEntry_Expecter) Info added in v1.31.0

Info is a helper method to define mock.On call

func (*MockDirEntry_Expecter) IsDir added in v1.31.0

IsDir is a helper method to define mock.On call

func (*MockDirEntry_Expecter) Name added in v1.31.0

Name is a helper method to define mock.On call

func (*MockDirEntry_Expecter) Type added in v1.31.0

Type is a helper method to define mock.On call

type MockDirEntry_Info_Call added in v1.31.0

type MockDirEntry_Info_Call struct {
	*mock.Call
}

MockDirEntry_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'

func (*MockDirEntry_Info_Call) Return added in v1.31.0

func (*MockDirEntry_Info_Call) Run added in v1.31.0

func (_c *MockDirEntry_Info_Call) Run(run func()) *MockDirEntry_Info_Call

func (*MockDirEntry_Info_Call) RunAndReturn added in v1.31.0

func (_c *MockDirEntry_Info_Call) RunAndReturn(run func() (fs.FileInfo, error)) *MockDirEntry_Info_Call

type MockDirEntry_IsDir_Call added in v1.31.0

type MockDirEntry_IsDir_Call struct {
	*mock.Call
}

MockDirEntry_IsDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDir'

func (*MockDirEntry_IsDir_Call) Return added in v1.31.0

func (*MockDirEntry_IsDir_Call) Run added in v1.31.0

func (_c *MockDirEntry_IsDir_Call) Run(run func()) *MockDirEntry_IsDir_Call

func (*MockDirEntry_IsDir_Call) RunAndReturn added in v1.31.0

func (_c *MockDirEntry_IsDir_Call) RunAndReturn(run func() bool) *MockDirEntry_IsDir_Call

type MockDirEntry_Name_Call added in v1.31.0

type MockDirEntry_Name_Call struct {
	*mock.Call
}

MockDirEntry_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockDirEntry_Name_Call) Return added in v1.31.0

func (*MockDirEntry_Name_Call) Run added in v1.31.0

func (_c *MockDirEntry_Name_Call) Run(run func()) *MockDirEntry_Name_Call

func (*MockDirEntry_Name_Call) RunAndReturn added in v1.31.0

func (_c *MockDirEntry_Name_Call) RunAndReturn(run func() string) *MockDirEntry_Name_Call

type MockDirEntry_Type_Call added in v1.31.0

type MockDirEntry_Type_Call struct {
	*mock.Call
}

MockDirEntry_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type'

func (*MockDirEntry_Type_Call) Return added in v1.31.0

func (*MockDirEntry_Type_Call) Run added in v1.31.0

func (_c *MockDirEntry_Type_Call) Run(run func()) *MockDirEntry_Type_Call

func (*MockDirEntry_Type_Call) RunAndReturn added in v1.31.0

func (_c *MockDirEntry_Type_Call) RunAndReturn(run func() fs.FileMode) *MockDirEntry_Type_Call

type MockRuntime added in v1.23.0

type MockRuntime struct {
	mock.Mock
}

MockRuntime is an autogenerated mock type for the Runtime type

func NewMockRuntime added in v1.23.0

func NewMockRuntime(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRuntime

NewMockRuntime creates a new instance of MockRuntime. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRuntime) APIVersion added in v1.23.0

func (_m *MockRuntime) APIVersion() (container.Version, error)

APIVersion provides a mock function with given fields:

func (*MockRuntime) CheckpointContainer added in v1.25.0

func (_m *MockRuntime) CheckpointContainer(ctx context.Context, options *v1.CheckpointContainerRequest) error

CheckpointContainer provides a mock function with given fields: ctx, options

func (*MockRuntime) DeleteContainer added in v1.23.0

func (_m *MockRuntime) DeleteContainer(ctx context.Context, containerID container.ContainerID) error

DeleteContainer provides a mock function with given fields: ctx, containerID

func (*MockRuntime) EXPECT added in v1.23.0

func (_m *MockRuntime) EXPECT() *MockRuntime_Expecter

func (*MockRuntime) GarbageCollect added in v1.23.0

func (_m *MockRuntime) GarbageCollect(ctx context.Context, gcPolicy container.GCPolicy, allSourcesReady bool, evictNonDeletedPods bool) error

GarbageCollect provides a mock function with given fields: ctx, gcPolicy, allSourcesReady, evictNonDeletedPods

func (*MockRuntime) GeneratePodStatus added in v1.26.0

func (_m *MockRuntime) GeneratePodStatus(event *v1.ContainerEventResponse) (*container.PodStatus, error)

GeneratePodStatus provides a mock function with given fields: event

func (*MockRuntime) GetContainerLogs added in v1.23.0

func (_m *MockRuntime) GetContainerLogs(ctx context.Context, pod *corev1.Pod, containerID container.ContainerID, logOptions *corev1.PodLogOptions, stdout io.Writer, stderr io.Writer) error

GetContainerLogs provides a mock function with given fields: ctx, pod, containerID, logOptions, stdout, stderr

func (*MockRuntime) GetImageRef added in v1.23.0

func (_m *MockRuntime) GetImageRef(ctx context.Context, image container.ImageSpec) (string, error)

GetImageRef provides a mock function with given fields: ctx, image

func (*MockRuntime) GetImageSize added in v1.30.0

func (_m *MockRuntime) GetImageSize(ctx context.Context, image container.ImageSpec) (uint64, error)

GetImageSize provides a mock function with given fields: ctx, image

func (*MockRuntime) GetPodStatus added in v1.23.0

func (_m *MockRuntime) GetPodStatus(ctx context.Context, uid types.UID, name string, namespace string) (*container.PodStatus, error)

GetPodStatus provides a mock function with given fields: ctx, uid, name, namespace

func (*MockRuntime) GetPods added in v1.23.0

func (_m *MockRuntime) GetPods(ctx context.Context, all bool) ([]*container.Pod, error)

GetPods provides a mock function with given fields: ctx, all

func (*MockRuntime) ImageFsInfo added in v1.29.0

func (_m *MockRuntime) ImageFsInfo(ctx context.Context) (*v1.ImageFsInfoResponse, error)

ImageFsInfo provides a mock function with given fields: ctx

func (*MockRuntime) ImageStats added in v1.23.0

func (_m *MockRuntime) ImageStats(ctx context.Context) (*container.ImageStats, error)

ImageStats provides a mock function with given fields: ctx

func (*MockRuntime) KillPod added in v1.23.0

func (_m *MockRuntime) KillPod(ctx context.Context, pod *corev1.Pod, runningPod container.Pod, gracePeriodOverride *int64) error

KillPod provides a mock function with given fields: ctx, pod, runningPod, gracePeriodOverride

func (*MockRuntime) ListImages added in v1.23.0

func (_m *MockRuntime) ListImages(ctx context.Context) ([]container.Image, error)

ListImages provides a mock function with given fields: ctx

func (*MockRuntime) ListMetricDescriptors added in v1.26.0

func (_m *MockRuntime) ListMetricDescriptors(ctx context.Context) ([]*v1.MetricDescriptor, error)

ListMetricDescriptors provides a mock function with given fields: ctx

func (*MockRuntime) ListPodSandboxMetrics added in v1.26.0

func (_m *MockRuntime) ListPodSandboxMetrics(ctx context.Context) ([]*v1.PodSandboxMetrics, error)

ListPodSandboxMetrics provides a mock function with given fields: ctx

func (*MockRuntime) PullImage added in v1.23.0

func (_m *MockRuntime) PullImage(ctx context.Context, image container.ImageSpec, pullSecrets []corev1.Secret, podSandboxConfig *v1.PodSandboxConfig) (string, error)

PullImage provides a mock function with given fields: ctx, image, pullSecrets, podSandboxConfig

func (*MockRuntime) RemoveImage added in v1.23.0

func (_m *MockRuntime) RemoveImage(ctx context.Context, image container.ImageSpec) error

RemoveImage provides a mock function with given fields: ctx, image

func (*MockRuntime) Status added in v1.23.0

Status provides a mock function with given fields: ctx

func (*MockRuntime) SyncPod added in v1.23.0

func (_m *MockRuntime) SyncPod(ctx context.Context, pod *corev1.Pod, podStatus *container.PodStatus, pullSecrets []corev1.Secret, backOff *flowcontrol.Backoff) container.PodSyncResult

SyncPod provides a mock function with given fields: ctx, pod, podStatus, pullSecrets, backOff

func (*MockRuntime) Type added in v1.23.0

func (_m *MockRuntime) Type() string

Type provides a mock function with given fields:

func (*MockRuntime) UpdatePodCIDR added in v1.23.0

func (_m *MockRuntime) UpdatePodCIDR(ctx context.Context, podCIDR string) error

UpdatePodCIDR provides a mock function with given fields: ctx, podCIDR

func (*MockRuntime) Version added in v1.23.0

func (_m *MockRuntime) Version(ctx context.Context) (container.Version, error)

Version provides a mock function with given fields: ctx

type MockRuntimeCache added in v1.8.0

type MockRuntimeCache struct {
	mock.Mock
}

MockRuntimeCache is an autogenerated mock type for the RuntimeCache type

func NewMockRuntimeCache added in v1.23.0

func NewMockRuntimeCache(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRuntimeCache

NewMockRuntimeCache creates a new instance of MockRuntimeCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRuntimeCache) EXPECT added in v1.23.0

func (*MockRuntimeCache) ForceUpdateIfOlder added in v1.8.0

func (_m *MockRuntimeCache) ForceUpdateIfOlder(_a0 context.Context, _a1 time.Time) error

ForceUpdateIfOlder provides a mock function with given fields: _a0, _a1

func (*MockRuntimeCache) GetPods added in v1.8.0

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

GetPods provides a mock function with given fields: _a0

type MockRuntimeCache_Expecter added in v1.31.0

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

func (*MockRuntimeCache_Expecter) ForceUpdateIfOlder added in v1.31.0

func (_e *MockRuntimeCache_Expecter) ForceUpdateIfOlder(_a0 interface{}, _a1 interface{}) *MockRuntimeCache_ForceUpdateIfOlder_Call

ForceUpdateIfOlder is a helper method to define mock.On call

  • _a0 context.Context
  • _a1 time.Time

func (*MockRuntimeCache_Expecter) GetPods added in v1.31.0

func (_e *MockRuntimeCache_Expecter) GetPods(_a0 interface{}) *MockRuntimeCache_GetPods_Call

GetPods is a helper method to define mock.On call

  • _a0 context.Context

type MockRuntimeCache_ForceUpdateIfOlder_Call added in v1.31.0

type MockRuntimeCache_ForceUpdateIfOlder_Call struct {
	*mock.Call
}

MockRuntimeCache_ForceUpdateIfOlder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForceUpdateIfOlder'

func (*MockRuntimeCache_ForceUpdateIfOlder_Call) Return added in v1.31.0

func (*MockRuntimeCache_ForceUpdateIfOlder_Call) Run added in v1.31.0

func (*MockRuntimeCache_ForceUpdateIfOlder_Call) RunAndReturn added in v1.31.0

type MockRuntimeCache_GetPods_Call added in v1.31.0

type MockRuntimeCache_GetPods_Call struct {
	*mock.Call
}

MockRuntimeCache_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods'

func (*MockRuntimeCache_GetPods_Call) Return added in v1.31.0

func (*MockRuntimeCache_GetPods_Call) Run added in v1.31.0

func (*MockRuntimeCache_GetPods_Call) RunAndReturn added in v1.31.0

type MockRuntime_APIVersion_Call added in v1.31.0

type MockRuntime_APIVersion_Call struct {
	*mock.Call
}

MockRuntime_APIVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'APIVersion'

func (*MockRuntime_APIVersion_Call) Return added in v1.31.0

func (*MockRuntime_APIVersion_Call) Run added in v1.31.0

func (*MockRuntime_APIVersion_Call) RunAndReturn added in v1.31.0

type MockRuntime_CheckpointContainer_Call added in v1.31.0

type MockRuntime_CheckpointContainer_Call struct {
	*mock.Call
}

MockRuntime_CheckpointContainer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckpointContainer'

func (*MockRuntime_CheckpointContainer_Call) Return added in v1.31.0

func (*MockRuntime_CheckpointContainer_Call) Run added in v1.31.0

func (*MockRuntime_CheckpointContainer_Call) RunAndReturn added in v1.31.0

type MockRuntime_DeleteContainer_Call added in v1.31.0

type MockRuntime_DeleteContainer_Call struct {
	*mock.Call
}

MockRuntime_DeleteContainer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteContainer'

func (*MockRuntime_DeleteContainer_Call) Return added in v1.31.0

func (*MockRuntime_DeleteContainer_Call) Run added in v1.31.0

func (*MockRuntime_DeleteContainer_Call) RunAndReturn added in v1.31.0

type MockRuntime_Expecter added in v1.31.0

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

func (*MockRuntime_Expecter) APIVersion added in v1.31.0

APIVersion is a helper method to define mock.On call

func (*MockRuntime_Expecter) CheckpointContainer added in v1.31.0

func (_e *MockRuntime_Expecter) CheckpointContainer(ctx interface{}, options interface{}) *MockRuntime_CheckpointContainer_Call

CheckpointContainer is a helper method to define mock.On call

  • ctx context.Context
  • options *v1.CheckpointContainerRequest

func (*MockRuntime_Expecter) DeleteContainer added in v1.31.0

func (_e *MockRuntime_Expecter) DeleteContainer(ctx interface{}, containerID interface{}) *MockRuntime_DeleteContainer_Call

DeleteContainer is a helper method to define mock.On call

  • ctx context.Context
  • containerID container.ContainerID

func (*MockRuntime_Expecter) GarbageCollect added in v1.31.0

func (_e *MockRuntime_Expecter) GarbageCollect(ctx interface{}, gcPolicy interface{}, allSourcesReady interface{}, evictNonDeletedPods interface{}) *MockRuntime_GarbageCollect_Call

GarbageCollect is a helper method to define mock.On call

  • ctx context.Context
  • gcPolicy container.GCPolicy
  • allSourcesReady bool
  • evictNonDeletedPods bool

func (*MockRuntime_Expecter) GeneratePodStatus added in v1.31.0

func (_e *MockRuntime_Expecter) GeneratePodStatus(event interface{}) *MockRuntime_GeneratePodStatus_Call

GeneratePodStatus is a helper method to define mock.On call

  • event *v1.ContainerEventResponse

func (*MockRuntime_Expecter) GetContainerLogs added in v1.31.0

func (_e *MockRuntime_Expecter) GetContainerLogs(ctx interface{}, pod interface{}, containerID interface{}, logOptions interface{}, stdout interface{}, stderr interface{}) *MockRuntime_GetContainerLogs_Call

GetContainerLogs is a helper method to define mock.On call

  • ctx context.Context
  • pod *corev1.Pod
  • containerID container.ContainerID
  • logOptions *corev1.PodLogOptions
  • stdout io.Writer
  • stderr io.Writer

func (*MockRuntime_Expecter) GetImageRef added in v1.31.0

func (_e *MockRuntime_Expecter) GetImageRef(ctx interface{}, image interface{}) *MockRuntime_GetImageRef_Call

GetImageRef is a helper method to define mock.On call

  • ctx context.Context
  • image container.ImageSpec

func (*MockRuntime_Expecter) GetImageSize added in v1.31.0

func (_e *MockRuntime_Expecter) GetImageSize(ctx interface{}, image interface{}) *MockRuntime_GetImageSize_Call

GetImageSize is a helper method to define mock.On call

  • ctx context.Context
  • image container.ImageSpec

func (*MockRuntime_Expecter) GetPodStatus added in v1.31.0

func (_e *MockRuntime_Expecter) GetPodStatus(ctx interface{}, uid interface{}, name interface{}, namespace interface{}) *MockRuntime_GetPodStatus_Call

GetPodStatus is a helper method to define mock.On call

  • ctx context.Context
  • uid types.UID
  • name string
  • namespace string

func (*MockRuntime_Expecter) GetPods added in v1.31.0

func (_e *MockRuntime_Expecter) GetPods(ctx interface{}, all interface{}) *MockRuntime_GetPods_Call

GetPods is a helper method to define mock.On call

  • ctx context.Context
  • all bool

func (*MockRuntime_Expecter) ImageFsInfo added in v1.31.0

func (_e *MockRuntime_Expecter) ImageFsInfo(ctx interface{}) *MockRuntime_ImageFsInfo_Call

ImageFsInfo is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) ImageStats added in v1.31.0

func (_e *MockRuntime_Expecter) ImageStats(ctx interface{}) *MockRuntime_ImageStats_Call

ImageStats is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) KillPod added in v1.31.0

func (_e *MockRuntime_Expecter) KillPod(ctx interface{}, pod interface{}, runningPod interface{}, gracePeriodOverride interface{}) *MockRuntime_KillPod_Call

KillPod is a helper method to define mock.On call

  • ctx context.Context
  • pod *corev1.Pod
  • runningPod container.Pod
  • gracePeriodOverride *int64

func (*MockRuntime_Expecter) ListImages added in v1.31.0

func (_e *MockRuntime_Expecter) ListImages(ctx interface{}) *MockRuntime_ListImages_Call

ListImages is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) ListMetricDescriptors added in v1.31.0

func (_e *MockRuntime_Expecter) ListMetricDescriptors(ctx interface{}) *MockRuntime_ListMetricDescriptors_Call

ListMetricDescriptors is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) ListPodSandboxMetrics added in v1.31.0

func (_e *MockRuntime_Expecter) ListPodSandboxMetrics(ctx interface{}) *MockRuntime_ListPodSandboxMetrics_Call

ListPodSandboxMetrics is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) PullImage added in v1.31.0

func (_e *MockRuntime_Expecter) PullImage(ctx interface{}, image interface{}, pullSecrets interface{}, podSandboxConfig interface{}) *MockRuntime_PullImage_Call

PullImage is a helper method to define mock.On call

  • ctx context.Context
  • image container.ImageSpec
  • pullSecrets []corev1.Secret
  • podSandboxConfig *v1.PodSandboxConfig

func (*MockRuntime_Expecter) RemoveImage added in v1.31.0

func (_e *MockRuntime_Expecter) RemoveImage(ctx interface{}, image interface{}) *MockRuntime_RemoveImage_Call

RemoveImage is a helper method to define mock.On call

  • ctx context.Context
  • image container.ImageSpec

func (*MockRuntime_Expecter) Status added in v1.31.0

func (_e *MockRuntime_Expecter) Status(ctx interface{}) *MockRuntime_Status_Call

Status is a helper method to define mock.On call

  • ctx context.Context

func (*MockRuntime_Expecter) SyncPod added in v1.31.0

func (_e *MockRuntime_Expecter) SyncPod(ctx interface{}, pod interface{}, podStatus interface{}, pullSecrets interface{}, backOff interface{}) *MockRuntime_SyncPod_Call

SyncPod is a helper method to define mock.On call

  • ctx context.Context
  • pod *corev1.Pod
  • podStatus *container.PodStatus
  • pullSecrets []corev1.Secret
  • backOff *flowcontrol.Backoff

func (*MockRuntime_Expecter) Type added in v1.31.0

Type is a helper method to define mock.On call

func (*MockRuntime_Expecter) UpdatePodCIDR added in v1.31.0

func (_e *MockRuntime_Expecter) UpdatePodCIDR(ctx interface{}, podCIDR interface{}) *MockRuntime_UpdatePodCIDR_Call

UpdatePodCIDR is a helper method to define mock.On call

  • ctx context.Context
  • podCIDR string

func (*MockRuntime_Expecter) Version added in v1.31.0

func (_e *MockRuntime_Expecter) Version(ctx interface{}) *MockRuntime_Version_Call

Version is a helper method to define mock.On call

  • ctx context.Context

type MockRuntime_GarbageCollect_Call added in v1.31.0

type MockRuntime_GarbageCollect_Call struct {
	*mock.Call
}

MockRuntime_GarbageCollect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GarbageCollect'

func (*MockRuntime_GarbageCollect_Call) Return added in v1.31.0

func (*MockRuntime_GarbageCollect_Call) Run added in v1.31.0

func (_c *MockRuntime_GarbageCollect_Call) Run(run func(ctx context.Context, gcPolicy container.GCPolicy, allSourcesReady bool, evictNonDeletedPods bool)) *MockRuntime_GarbageCollect_Call

func (*MockRuntime_GarbageCollect_Call) RunAndReturn added in v1.31.0

type MockRuntime_GeneratePodStatus_Call added in v1.31.0

type MockRuntime_GeneratePodStatus_Call struct {
	*mock.Call
}

MockRuntime_GeneratePodStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GeneratePodStatus'

func (*MockRuntime_GeneratePodStatus_Call) Return added in v1.31.0

func (*MockRuntime_GeneratePodStatus_Call) Run added in v1.31.0

func (*MockRuntime_GeneratePodStatus_Call) RunAndReturn added in v1.31.0

type MockRuntime_GetContainerLogs_Call added in v1.31.0

type MockRuntime_GetContainerLogs_Call struct {
	*mock.Call
}

MockRuntime_GetContainerLogs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetContainerLogs'

func (*MockRuntime_GetContainerLogs_Call) Return added in v1.31.0

func (*MockRuntime_GetContainerLogs_Call) Run added in v1.31.0

func (*MockRuntime_GetContainerLogs_Call) RunAndReturn added in v1.31.0

type MockRuntime_GetImageRef_Call added in v1.31.0

type MockRuntime_GetImageRef_Call struct {
	*mock.Call
}

MockRuntime_GetImageRef_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImageRef'

func (*MockRuntime_GetImageRef_Call) Return added in v1.31.0

func (*MockRuntime_GetImageRef_Call) Run added in v1.31.0

func (*MockRuntime_GetImageRef_Call) RunAndReturn added in v1.31.0

type MockRuntime_GetImageSize_Call added in v1.31.0

type MockRuntime_GetImageSize_Call struct {
	*mock.Call
}

MockRuntime_GetImageSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetImageSize'

func (*MockRuntime_GetImageSize_Call) Return added in v1.31.0

func (*MockRuntime_GetImageSize_Call) Run added in v1.31.0

func (*MockRuntime_GetImageSize_Call) RunAndReturn added in v1.31.0

type MockRuntime_GetPodStatus_Call added in v1.31.0

type MockRuntime_GetPodStatus_Call struct {
	*mock.Call
}

MockRuntime_GetPodStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodStatus'

func (*MockRuntime_GetPodStatus_Call) Return added in v1.31.0

func (*MockRuntime_GetPodStatus_Call) Run added in v1.31.0

func (_c *MockRuntime_GetPodStatus_Call) Run(run func(ctx context.Context, uid types.UID, name string, namespace string)) *MockRuntime_GetPodStatus_Call

func (*MockRuntime_GetPodStatus_Call) RunAndReturn added in v1.31.0

type MockRuntime_GetPods_Call added in v1.31.0

type MockRuntime_GetPods_Call struct {
	*mock.Call
}

MockRuntime_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods'

func (*MockRuntime_GetPods_Call) Return added in v1.31.0

func (*MockRuntime_GetPods_Call) Run added in v1.31.0

func (*MockRuntime_GetPods_Call) RunAndReturn added in v1.31.0

type MockRuntime_ImageFsInfo_Call added in v1.31.0

type MockRuntime_ImageFsInfo_Call struct {
	*mock.Call
}

MockRuntime_ImageFsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ImageFsInfo'

func (*MockRuntime_ImageFsInfo_Call) Return added in v1.31.0

func (*MockRuntime_ImageFsInfo_Call) Run added in v1.31.0

func (*MockRuntime_ImageFsInfo_Call) RunAndReturn added in v1.31.0

type MockRuntime_ImageStats_Call added in v1.31.0

type MockRuntime_ImageStats_Call struct {
	*mock.Call
}

MockRuntime_ImageStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ImageStats'

func (*MockRuntime_ImageStats_Call) Return added in v1.31.0

func (*MockRuntime_ImageStats_Call) Run added in v1.31.0

func (*MockRuntime_ImageStats_Call) RunAndReturn added in v1.31.0

type MockRuntime_KillPod_Call added in v1.31.0

type MockRuntime_KillPod_Call struct {
	*mock.Call
}

MockRuntime_KillPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'KillPod'

func (*MockRuntime_KillPod_Call) Return added in v1.31.0

func (*MockRuntime_KillPod_Call) Run added in v1.31.0

func (_c *MockRuntime_KillPod_Call) Run(run func(ctx context.Context, pod *corev1.Pod, runningPod container.Pod, gracePeriodOverride *int64)) *MockRuntime_KillPod_Call

func (*MockRuntime_KillPod_Call) RunAndReturn added in v1.31.0

type MockRuntime_ListImages_Call added in v1.31.0

type MockRuntime_ListImages_Call struct {
	*mock.Call
}

MockRuntime_ListImages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListImages'

func (*MockRuntime_ListImages_Call) Return added in v1.31.0

func (*MockRuntime_ListImages_Call) Run added in v1.31.0

func (*MockRuntime_ListImages_Call) RunAndReturn added in v1.31.0

type MockRuntime_ListMetricDescriptors_Call added in v1.31.0

type MockRuntime_ListMetricDescriptors_Call struct {
	*mock.Call
}

MockRuntime_ListMetricDescriptors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMetricDescriptors'

func (*MockRuntime_ListMetricDescriptors_Call) Return added in v1.31.0

func (*MockRuntime_ListMetricDescriptors_Call) Run added in v1.31.0

func (*MockRuntime_ListMetricDescriptors_Call) RunAndReturn added in v1.31.0

type MockRuntime_ListPodSandboxMetrics_Call added in v1.31.0

type MockRuntime_ListPodSandboxMetrics_Call struct {
	*mock.Call
}

MockRuntime_ListPodSandboxMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPodSandboxMetrics'

func (*MockRuntime_ListPodSandboxMetrics_Call) Return added in v1.31.0

func (*MockRuntime_ListPodSandboxMetrics_Call) Run added in v1.31.0

func (*MockRuntime_ListPodSandboxMetrics_Call) RunAndReturn added in v1.31.0

type MockRuntime_PullImage_Call added in v1.31.0

type MockRuntime_PullImage_Call struct {
	*mock.Call
}

MockRuntime_PullImage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PullImage'

func (*MockRuntime_PullImage_Call) Return added in v1.31.0

func (*MockRuntime_PullImage_Call) Run added in v1.31.0

func (_c *MockRuntime_PullImage_Call) Run(run func(ctx context.Context, image container.ImageSpec, pullSecrets []corev1.Secret, podSandboxConfig *v1.PodSandboxConfig)) *MockRuntime_PullImage_Call

func (*MockRuntime_PullImage_Call) RunAndReturn added in v1.31.0

type MockRuntime_RemoveImage_Call added in v1.31.0

type MockRuntime_RemoveImage_Call struct {
	*mock.Call
}

MockRuntime_RemoveImage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveImage'

func (*MockRuntime_RemoveImage_Call) Return added in v1.31.0

func (*MockRuntime_RemoveImage_Call) Run added in v1.31.0

func (*MockRuntime_RemoveImage_Call) RunAndReturn added in v1.31.0

type MockRuntime_Status_Call added in v1.31.0

type MockRuntime_Status_Call struct {
	*mock.Call
}

MockRuntime_Status_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Status'

func (*MockRuntime_Status_Call) Return added in v1.31.0

func (*MockRuntime_Status_Call) Run added in v1.31.0

func (*MockRuntime_Status_Call) RunAndReturn added in v1.31.0

type MockRuntime_SyncPod_Call added in v1.31.0

type MockRuntime_SyncPod_Call struct {
	*mock.Call
}

MockRuntime_SyncPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncPod'

func (*MockRuntime_SyncPod_Call) Return added in v1.31.0

func (*MockRuntime_SyncPod_Call) Run added in v1.31.0

func (_c *MockRuntime_SyncPod_Call) Run(run func(ctx context.Context, pod *corev1.Pod, podStatus *container.PodStatus, pullSecrets []corev1.Secret, backOff *flowcontrol.Backoff)) *MockRuntime_SyncPod_Call

func (*MockRuntime_SyncPod_Call) RunAndReturn added in v1.31.0

type MockRuntime_Type_Call added in v1.31.0

type MockRuntime_Type_Call struct {
	*mock.Call
}

MockRuntime_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type'

func (*MockRuntime_Type_Call) Return added in v1.31.0

func (*MockRuntime_Type_Call) Run added in v1.31.0

func (_c *MockRuntime_Type_Call) Run(run func()) *MockRuntime_Type_Call

func (*MockRuntime_Type_Call) RunAndReturn added in v1.31.0

func (_c *MockRuntime_Type_Call) RunAndReturn(run func() string) *MockRuntime_Type_Call

type MockRuntime_UpdatePodCIDR_Call added in v1.31.0

type MockRuntime_UpdatePodCIDR_Call struct {
	*mock.Call
}

MockRuntime_UpdatePodCIDR_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePodCIDR'

func (*MockRuntime_UpdatePodCIDR_Call) Return added in v1.31.0

func (*MockRuntime_UpdatePodCIDR_Call) Run added in v1.31.0

func (*MockRuntime_UpdatePodCIDR_Call) RunAndReturn added in v1.31.0

type MockRuntime_Version_Call added in v1.31.0

type MockRuntime_Version_Call struct {
	*mock.Call
}

MockRuntime_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version'

func (*MockRuntime_Version_Call) Return added in v1.31.0

func (*MockRuntime_Version_Call) Run added in v1.31.0

func (*MockRuntime_Version_Call) RunAndReturn added in v1.31.0

type TB added in v1.30.0

type TB interface {
	Errorf(format string, args ...any)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL