Switch to stretchr/testify / mockery for mocks
testify is used throughout the codebase; this switches mocks from gomock to testify with the help of mockery for code generation. Handlers and mocks in test/utils/oidc are moved to a new package: mockery operates package by package, and requires packages to build correctly; test/utils/oidc/testserver.go relies on the mocks and fails to build when they are removed. Moving the interface and mocks to a different package allows mockery to process that package without having to build testserver.go. Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
16
pkg/kubelet/apis/podresources/.mockery.yaml
Normal file
16
pkg/kubelet/apis/podresources/.mockery.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: "{{.InterfaceName | snakecase}}.go"
|
||||
boilerplate-file: ../../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/apis/podresources:
|
||||
interfaces:
|
||||
CPUsProvider:
|
||||
config:
|
||||
filename: cpus_provider.go
|
||||
DevicesProvider:
|
||||
DynamicResourcesProvider:
|
||||
MemoryProvider:
|
||||
PodsProvider:
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -43,9 +42,6 @@ func TestListPodResourcesV1(t *testing.T) {
|
||||
containerName := "container-name"
|
||||
numaID := int64(1)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
devs := []*podresourcesapi.ContainerDevices{
|
||||
{
|
||||
ResourceName: "resource",
|
||||
@@ -215,21 +211,21 @@ func TestListPodResourcesV1(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(mockCtrl)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(mockCtrl)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(mockCtrl)
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(t)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(t)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(t)
|
||||
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(tc.cpus).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(tc.memory).AnyTimes()
|
||||
mockDynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &containers[0]).Return(tc.dynamicResources).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return([]int64{}).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return([]*podresourcesapi.ContainerDevices{}).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return([]*podresourcesapi.ContainerMemory{}).AnyTimes()
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).Maybe()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).Maybe()
|
||||
mockCPUsProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(tc.cpus).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(tc.memory).Maybe()
|
||||
mockDynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &containers[0]).Return(tc.dynamicResources).Maybe()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return([]int64{}).Maybe()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return([]*podresourcesapi.ContainerDevices{}).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return([]*podresourcesapi.ContainerMemory{}).Maybe()
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
Pods: mockPodsProvider,
|
||||
@@ -327,11 +323,11 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
expectedResponse: &podresourcesapi.ListPodResourcesResponse{
|
||||
@@ -377,11 +373,11 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
sidecarContainersEnabled: true,
|
||||
@@ -429,12 +425,12 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
expectedResponse: &podresourcesapi.ListPodResourcesResponse{
|
||||
@@ -481,17 +477,17 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), initContainerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), initContainerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), initContainerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.InitContainers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), initContainerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), initContainerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), initContainerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.InitContainers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pods[0], &pods[0].Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
sidecarContainersEnabled: true,
|
||||
@@ -524,16 +520,13 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.SidecarContainers, tc.sidecarContainersEnabled)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(t)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(t)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(t)
|
||||
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(mockCtrl)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(mockCtrl)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(mockCtrl)
|
||||
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).AnyTimes()
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).Maybe()
|
||||
tc.mockFunc(tc.pods, mockDevicesProvider, mockCPUsProvider, mockMemoryProvider, mockDynamicResourcesProvider)
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
@@ -556,9 +549,6 @@ func TestListPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllocatableResources(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
allDevs := []*podresourcesapi.ContainerDevices{
|
||||
{
|
||||
ResourceName: "resource",
|
||||
@@ -815,18 +805,18 @@ func TestAllocatableResources(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(mockCtrl)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(mockCtrl)
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(t)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(t)
|
||||
|
||||
mockDevicesProvider.EXPECT().GetDevices("", "").Return([]*podresourcesapi.ContainerDevices{}).AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetCPUs("", "").Return([]int64{}).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetMemory("", "").Return([]*podresourcesapi.ContainerMemory{}).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return(tc.allDevices).AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return(tc.allCPUs).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return(tc.allMemory).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetDevices("", "").Return([]*podresourcesapi.ContainerDevices{}).Maybe()
|
||||
mockCPUsProvider.EXPECT().GetCPUs("", "").Return([]int64{}).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetMemory("", "").Return([]*podresourcesapi.ContainerMemory{}).Maybe()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return(tc.allDevices).Maybe()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return(tc.allCPUs).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return(tc.allMemory).Maybe()
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
Pods: mockPodsProvider,
|
||||
@@ -858,9 +848,6 @@ func TestGetPodResourcesV1(t *testing.T) {
|
||||
containerName := "container-name"
|
||||
numaID := int64(1)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
devs := []*podresourcesapi.ContainerDevices{
|
||||
{
|
||||
ResourceName: "resource",
|
||||
@@ -984,21 +971,21 @@ func TestGetPodResourcesV1(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(mockCtrl)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(mockCtrl)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(mockCtrl)
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(t)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(t)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(t)
|
||||
|
||||
mockPodsProvider.EXPECT().GetPodByName(podNamespace, podName).Return(tc.pod, tc.exist).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(tc.cpus).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(tc.memory).AnyTimes()
|
||||
mockDynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &containers[0]).Return(tc.dynamicResources).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return([]int64{}).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return([]*podresourcesapi.ContainerDevices{}).AnyTimes()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return([]*podresourcesapi.ContainerMemory{}).AnyTimes()
|
||||
mockPodsProvider.EXPECT().GetPodByName(podNamespace, podName).Return(tc.pod, tc.exist).Maybe()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).Maybe()
|
||||
mockCPUsProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(tc.cpus).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(tc.memory).Maybe()
|
||||
mockDynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &containers[0]).Return(tc.dynamicResources).Maybe()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
mockCPUsProvider.EXPECT().GetAllocatableCPUs().Return([]int64{}).Maybe()
|
||||
mockDevicesProvider.EXPECT().GetAllocatableDevices().Return([]*podresourcesapi.ContainerDevices{}).Maybe()
|
||||
mockMemoryProvider.EXPECT().GetAllocatableMemory().Return([]*podresourcesapi.ContainerMemory{}).Maybe()
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
Pods: mockPodsProvider,
|
||||
@@ -1105,11 +1092,11 @@ func TestGetPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
expectedResponse: &podresourcesapi.GetPodResourcesResponse{
|
||||
@@ -1151,11 +1138,11 @@ func TestGetPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
sidecarContainersEnabled: true,
|
||||
@@ -1199,12 +1186,12 @@ func TestGetPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
expectedResponse: &podresourcesapi.GetPodResourcesResponse{
|
||||
@@ -1247,17 +1234,17 @@ func TestGetPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
cpusProvider *podresourcetest.MockCPUsProvider,
|
||||
memoryProvider *podresourcetest.MockMemoryProvider,
|
||||
dynamicResourcesProvider *podresourcetest.MockDynamicResourcesProvider) {
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
devicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), initContainerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), initContainerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), initContainerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.InitContainers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), initContainerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), initContainerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), initContainerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.InitContainers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).AnyTimes()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).AnyTimes()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).AnyTimes()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).AnyTimes()
|
||||
devicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(devs).Maybe()
|
||||
cpusProvider.EXPECT().GetCPUs(string(podUID), containerName).Return(cpus).Maybe()
|
||||
memoryProvider.EXPECT().GetMemory(string(podUID), containerName).Return(memory).Maybe()
|
||||
dynamicResourcesProvider.EXPECT().GetDynamicResources(pod, &pod.Spec.Containers[0]).Return([]*podresourcesapi.DynamicResource{}).Maybe()
|
||||
|
||||
},
|
||||
sidecarContainersEnabled: true,
|
||||
@@ -1288,16 +1275,13 @@ func TestGetPodResourcesWithInitContainersV1(t *testing.T) {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, pkgfeatures.SidecarContainers, tc.sidecarContainersEnabled)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(t)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(t)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(t)
|
||||
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockCPUsProvider := podresourcetest.NewMockCPUsProvider(mockCtrl)
|
||||
mockMemoryProvider := podresourcetest.NewMockMemoryProvider(mockCtrl)
|
||||
mockDynamicResourcesProvider := podresourcetest.NewMockDynamicResourcesProvider(mockCtrl)
|
||||
|
||||
mockPodsProvider.EXPECT().GetPodByName(podNamespace, podName).Return(tc.pod, true).AnyTimes()
|
||||
mockPodsProvider.EXPECT().GetPodByName(podNamespace, podName).Return(tc.pod, true).Maybe()
|
||||
tc.mockFunc(tc.pod, mockDevicesProvider, mockCPUsProvider, mockMemoryProvider, mockDynamicResourcesProvider)
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -42,9 +41,6 @@ func TestListPodResourcesV1alpha1(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
for _, tc := range []struct {
|
||||
desc string
|
||||
pods []*v1.Pod
|
||||
@@ -127,12 +123,12 @@ func TestListPodResourcesV1alpha1(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(mockCtrl)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(mockCtrl)
|
||||
mockDevicesProvider := podresourcetest.NewMockDevicesProvider(t)
|
||||
mockPodsProvider := podresourcetest.NewMockPodsProvider(t)
|
||||
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).AnyTimes()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().AnyTimes()
|
||||
mockPodsProvider.EXPECT().GetPods().Return(tc.pods).Maybe()
|
||||
mockDevicesProvider.EXPECT().GetDevices(string(podUID), containerName).Return(tc.devices).Maybe()
|
||||
mockDevicesProvider.EXPECT().UpdateAllocatedDevices().Return().Maybe()
|
||||
|
||||
providers := PodResourcesProviders{
|
||||
Pods: mockPodsProvider,
|
||||
|
||||
144
pkg/kubelet/apis/podresources/testing/cpus_provider.go
Normal file
144
pkg/kubelet/apis/podresources/testing/cpus_provider.go
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
|
||||
// MockCPUsProvider is an autogenerated mock type for the CPUsProvider type
|
||||
type MockCPUsProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockCPUsProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockCPUsProvider) EXPECT() *MockCPUsProvider_Expecter {
|
||||
return &MockCPUsProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetAllocatableCPUs provides a mock function with given fields:
|
||||
func (_m *MockCPUsProvider) GetAllocatableCPUs() []int64 {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetAllocatableCPUs")
|
||||
}
|
||||
|
||||
var r0 []int64
|
||||
if rf, ok := ret.Get(0).(func() []int64); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]int64)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockCPUsProvider_GetAllocatableCPUs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatableCPUs'
|
||||
type MockCPUsProvider_GetAllocatableCPUs_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetAllocatableCPUs is a helper method to define mock.On call
|
||||
func (_e *MockCPUsProvider_Expecter) GetAllocatableCPUs() *MockCPUsProvider_GetAllocatableCPUs_Call {
|
||||
return &MockCPUsProvider_GetAllocatableCPUs_Call{Call: _e.mock.On("GetAllocatableCPUs")}
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetAllocatableCPUs_Call) Run(run func()) *MockCPUsProvider_GetAllocatableCPUs_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetAllocatableCPUs_Call) Return(_a0 []int64) *MockCPUsProvider_GetAllocatableCPUs_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetAllocatableCPUs_Call) RunAndReturn(run func() []int64) *MockCPUsProvider_GetAllocatableCPUs_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetCPUs provides a mock function with given fields: podUID, containerName
|
||||
func (_m *MockCPUsProvider) GetCPUs(podUID string, containerName string) []int64 {
|
||||
ret := _m.Called(podUID, containerName)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetCPUs")
|
||||
}
|
||||
|
||||
var r0 []int64
|
||||
if rf, ok := ret.Get(0).(func(string, string) []int64); ok {
|
||||
r0 = rf(podUID, containerName)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]int64)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockCPUsProvider_GetCPUs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCPUs'
|
||||
type MockCPUsProvider_GetCPUs_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetCPUs is a helper method to define mock.On call
|
||||
// - podUID string
|
||||
// - containerName string
|
||||
func (_e *MockCPUsProvider_Expecter) GetCPUs(podUID interface{}, containerName interface{}) *MockCPUsProvider_GetCPUs_Call {
|
||||
return &MockCPUsProvider_GetCPUs_Call{Call: _e.mock.On("GetCPUs", podUID, containerName)}
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetCPUs_Call) Run(run func(podUID string, containerName string)) *MockCPUsProvider_GetCPUs_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetCPUs_Call) Return(_a0 []int64) *MockCPUsProvider_GetCPUs_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCPUsProvider_GetCPUs_Call) RunAndReturn(run func(string, string) []int64) *MockCPUsProvider_GetCPUs_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockCPUsProvider creates a new instance of MockCPUsProvider. 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 NewMockCPUsProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockCPUsProvider {
|
||||
mock := &MockCPUsProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
180
pkg/kubelet/apis/podresources/testing/devices_provider.go
Normal file
180
pkg/kubelet/apis/podresources/testing/devices_provider.go
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
v1 "k8s.io/kubelet/pkg/apis/podresources/v1"
|
||||
)
|
||||
|
||||
// MockDevicesProvider is an autogenerated mock type for the DevicesProvider type
|
||||
type MockDevicesProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockDevicesProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockDevicesProvider) EXPECT() *MockDevicesProvider_Expecter {
|
||||
return &MockDevicesProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetAllocatableDevices provides a mock function with given fields:
|
||||
func (_m *MockDevicesProvider) GetAllocatableDevices() []*v1.ContainerDevices {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetAllocatableDevices")
|
||||
}
|
||||
|
||||
var r0 []*v1.ContainerDevices
|
||||
if rf, ok := ret.Get(0).(func() []*v1.ContainerDevices); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.ContainerDevices)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDevicesProvider_GetAllocatableDevices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatableDevices'
|
||||
type MockDevicesProvider_GetAllocatableDevices_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetAllocatableDevices is a helper method to define mock.On call
|
||||
func (_e *MockDevicesProvider_Expecter) GetAllocatableDevices() *MockDevicesProvider_GetAllocatableDevices_Call {
|
||||
return &MockDevicesProvider_GetAllocatableDevices_Call{Call: _e.mock.On("GetAllocatableDevices")}
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetAllocatableDevices_Call) Run(run func()) *MockDevicesProvider_GetAllocatableDevices_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetAllocatableDevices_Call) Return(_a0 []*v1.ContainerDevices) *MockDevicesProvider_GetAllocatableDevices_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetAllocatableDevices_Call) RunAndReturn(run func() []*v1.ContainerDevices) *MockDevicesProvider_GetAllocatableDevices_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetDevices provides a mock function with given fields: podUID, containerName
|
||||
func (_m *MockDevicesProvider) GetDevices(podUID string, containerName string) []*v1.ContainerDevices {
|
||||
ret := _m.Called(podUID, containerName)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetDevices")
|
||||
}
|
||||
|
||||
var r0 []*v1.ContainerDevices
|
||||
if rf, ok := ret.Get(0).(func(string, string) []*v1.ContainerDevices); ok {
|
||||
r0 = rf(podUID, containerName)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.ContainerDevices)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDevicesProvider_GetDevices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDevices'
|
||||
type MockDevicesProvider_GetDevices_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetDevices is a helper method to define mock.On call
|
||||
// - podUID string
|
||||
// - containerName string
|
||||
func (_e *MockDevicesProvider_Expecter) GetDevices(podUID interface{}, containerName interface{}) *MockDevicesProvider_GetDevices_Call {
|
||||
return &MockDevicesProvider_GetDevices_Call{Call: _e.mock.On("GetDevices", podUID, containerName)}
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetDevices_Call) Run(run func(podUID string, containerName string)) *MockDevicesProvider_GetDevices_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetDevices_Call) Return(_a0 []*v1.ContainerDevices) *MockDevicesProvider_GetDevices_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_GetDevices_Call) RunAndReturn(run func(string, string) []*v1.ContainerDevices) *MockDevicesProvider_GetDevices_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UpdateAllocatedDevices provides a mock function with given fields:
|
||||
func (_m *MockDevicesProvider) UpdateAllocatedDevices() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// MockDevicesProvider_UpdateAllocatedDevices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAllocatedDevices'
|
||||
type MockDevicesProvider_UpdateAllocatedDevices_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UpdateAllocatedDevices is a helper method to define mock.On call
|
||||
func (_e *MockDevicesProvider_Expecter) UpdateAllocatedDevices() *MockDevicesProvider_UpdateAllocatedDevices_Call {
|
||||
return &MockDevicesProvider_UpdateAllocatedDevices_Call{Call: _e.mock.On("UpdateAllocatedDevices")}
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_UpdateAllocatedDevices_Call) Run(run func()) *MockDevicesProvider_UpdateAllocatedDevices_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_UpdateAllocatedDevices_Call) Return() *MockDevicesProvider_UpdateAllocatedDevices_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDevicesProvider_UpdateAllocatedDevices_Call) RunAndReturn(run func()) *MockDevicesProvider_UpdateAllocatedDevices_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockDevicesProvider creates a new instance of MockDevicesProvider. 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 NewMockDevicesProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockDevicesProvider {
|
||||
mock := &MockDevicesProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
podresourcesv1 "k8s.io/kubelet/pkg/apis/podresources/v1"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// MockDynamicResourcesProvider is an autogenerated mock type for the DynamicResourcesProvider type
|
||||
type MockDynamicResourcesProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockDynamicResourcesProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockDynamicResourcesProvider) EXPECT() *MockDynamicResourcesProvider_Expecter {
|
||||
return &MockDynamicResourcesProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetDynamicResources provides a mock function with given fields: pod, container
|
||||
func (_m *MockDynamicResourcesProvider) GetDynamicResources(pod *v1.Pod, container *v1.Container) []*podresourcesv1.DynamicResource {
|
||||
ret := _m.Called(pod, container)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetDynamicResources")
|
||||
}
|
||||
|
||||
var r0 []*podresourcesv1.DynamicResource
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod, *v1.Container) []*podresourcesv1.DynamicResource); ok {
|
||||
r0 = rf(pod, container)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*podresourcesv1.DynamicResource)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDynamicResourcesProvider_GetDynamicResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDynamicResources'
|
||||
type MockDynamicResourcesProvider_GetDynamicResources_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetDynamicResources is a helper method to define mock.On call
|
||||
// - pod *v1.Pod
|
||||
// - container *v1.Container
|
||||
func (_e *MockDynamicResourcesProvider_Expecter) GetDynamicResources(pod interface{}, container interface{}) *MockDynamicResourcesProvider_GetDynamicResources_Call {
|
||||
return &MockDynamicResourcesProvider_GetDynamicResources_Call{Call: _e.mock.On("GetDynamicResources", pod, container)}
|
||||
}
|
||||
|
||||
func (_c *MockDynamicResourcesProvider_GetDynamicResources_Call) Run(run func(pod *v1.Pod, container *v1.Container)) *MockDynamicResourcesProvider_GetDynamicResources_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod), args[1].(*v1.Container))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDynamicResourcesProvider_GetDynamicResources_Call) Return(_a0 []*podresourcesv1.DynamicResource) *MockDynamicResourcesProvider_GetDynamicResources_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDynamicResourcesProvider_GetDynamicResources_Call) RunAndReturn(run func(*v1.Pod, *v1.Container) []*podresourcesv1.DynamicResource) *MockDynamicResourcesProvider_GetDynamicResources_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockDynamicResourcesProvider creates a new instance of MockDynamicResourcesProvider. 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 NewMockDynamicResourcesProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockDynamicResourcesProvider {
|
||||
mock := &MockDynamicResourcesProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
148
pkg/kubelet/apis/podresources/testing/memory_provider.go
Normal file
148
pkg/kubelet/apis/podresources/testing/memory_provider.go
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
v1 "k8s.io/kubelet/pkg/apis/podresources/v1"
|
||||
)
|
||||
|
||||
// MockMemoryProvider is an autogenerated mock type for the MemoryProvider type
|
||||
type MockMemoryProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockMemoryProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockMemoryProvider) EXPECT() *MockMemoryProvider_Expecter {
|
||||
return &MockMemoryProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetAllocatableMemory provides a mock function with given fields:
|
||||
func (_m *MockMemoryProvider) GetAllocatableMemory() []*v1.ContainerMemory {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetAllocatableMemory")
|
||||
}
|
||||
|
||||
var r0 []*v1.ContainerMemory
|
||||
if rf, ok := ret.Get(0).(func() []*v1.ContainerMemory); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.ContainerMemory)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockMemoryProvider_GetAllocatableMemory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllocatableMemory'
|
||||
type MockMemoryProvider_GetAllocatableMemory_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetAllocatableMemory is a helper method to define mock.On call
|
||||
func (_e *MockMemoryProvider_Expecter) GetAllocatableMemory() *MockMemoryProvider_GetAllocatableMemory_Call {
|
||||
return &MockMemoryProvider_GetAllocatableMemory_Call{Call: _e.mock.On("GetAllocatableMemory")}
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetAllocatableMemory_Call) Run(run func()) *MockMemoryProvider_GetAllocatableMemory_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetAllocatableMemory_Call) Return(_a0 []*v1.ContainerMemory) *MockMemoryProvider_GetAllocatableMemory_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetAllocatableMemory_Call) RunAndReturn(run func() []*v1.ContainerMemory) *MockMemoryProvider_GetAllocatableMemory_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetMemory provides a mock function with given fields: podUID, containerName
|
||||
func (_m *MockMemoryProvider) GetMemory(podUID string, containerName string) []*v1.ContainerMemory {
|
||||
ret := _m.Called(podUID, containerName)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetMemory")
|
||||
}
|
||||
|
||||
var r0 []*v1.ContainerMemory
|
||||
if rf, ok := ret.Get(0).(func(string, string) []*v1.ContainerMemory); ok {
|
||||
r0 = rf(podUID, containerName)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.ContainerMemory)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockMemoryProvider_GetMemory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMemory'
|
||||
type MockMemoryProvider_GetMemory_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetMemory is a helper method to define mock.On call
|
||||
// - podUID string
|
||||
// - containerName string
|
||||
func (_e *MockMemoryProvider_Expecter) GetMemory(podUID interface{}, containerName interface{}) *MockMemoryProvider_GetMemory_Call {
|
||||
return &MockMemoryProvider_GetMemory_Call{Call: _e.mock.On("GetMemory", podUID, containerName)}
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetMemory_Call) Run(run func(podUID string, containerName string)) *MockMemoryProvider_GetMemory_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetMemory_Call) Return(_a0 []*v1.ContainerMemory) *MockMemoryProvider_GetMemory_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockMemoryProvider_GetMemory_Call) RunAndReturn(run func(string, string) []*v1.ContainerMemory) *MockMemoryProvider_GetMemory_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockMemoryProvider creates a new instance of MockMemoryProvider. 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 NewMockMemoryProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockMemoryProvider {
|
||||
mock := &MockMemoryProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
158
pkg/kubelet/apis/podresources/testing/pods_provider.go
Normal file
158
pkg/kubelet/apis/podresources/testing/pods_provider.go
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// MockPodsProvider is an autogenerated mock type for the PodsProvider type
|
||||
type MockPodsProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockPodsProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockPodsProvider) EXPECT() *MockPodsProvider_Expecter {
|
||||
return &MockPodsProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetPodByName provides a mock function with given fields: namespace, name
|
||||
func (_m *MockPodsProvider) GetPodByName(namespace string, name string) (*v1.Pod, bool) {
|
||||
ret := _m.Called(namespace, name)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodByName")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(string, string) (*v1.Pod, bool)); ok {
|
||||
return rf(namespace, name)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) *v1.Pod); ok {
|
||||
r0 = rf(namespace, name)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) bool); ok {
|
||||
r1 = rf(namespace, name)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockPodsProvider_GetPodByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByName'
|
||||
type MockPodsProvider_GetPodByName_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodByName is a helper method to define mock.On call
|
||||
// - namespace string
|
||||
// - name string
|
||||
func (_e *MockPodsProvider_Expecter) GetPodByName(namespace interface{}, name interface{}) *MockPodsProvider_GetPodByName_Call {
|
||||
return &MockPodsProvider_GetPodByName_Call{Call: _e.mock.On("GetPodByName", namespace, name)}
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPodByName_Call) Run(run func(namespace string, name string)) *MockPodsProvider_GetPodByName_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPodByName_Call) Return(_a0 *v1.Pod, _a1 bool) *MockPodsProvider_GetPodByName_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPodByName_Call) RunAndReturn(run func(string, string) (*v1.Pod, bool)) *MockPodsProvider_GetPodByName_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPods provides a mock function with given fields:
|
||||
func (_m *MockPodsProvider) GetPods() []*v1.Pod {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPods")
|
||||
}
|
||||
|
||||
var r0 []*v1.Pod
|
||||
if rf, ok := ret.Get(0).(func() []*v1.Pod); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockPodsProvider_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods'
|
||||
type MockPodsProvider_GetPods_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPods is a helper method to define mock.On call
|
||||
func (_e *MockPodsProvider_Expecter) GetPods() *MockPodsProvider_GetPods_Call {
|
||||
return &MockPodsProvider_GetPods_Call{Call: _e.mock.On("GetPods")}
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPods_Call) Run(run func()) *MockPodsProvider_GetPods_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPods_Call) Return(_a0 []*v1.Pod) *MockPodsProvider_GetPods_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodsProvider_GetPods_Call) RunAndReturn(run func() []*v1.Pod) *MockPodsProvider_GetPods_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockPodsProvider creates a new instance of MockPodsProvider. 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 NewMockPodsProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockPodsProvider {
|
||||
mock := &MockPodsProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: types.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=types.go -destination=testing/provider_mock.go -package=testing DevicesProvider,PodsProvider,CPUsProvider,MemoryProvider
|
||||
//
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
v10 "k8s.io/kubelet/pkg/apis/podresources/v1"
|
||||
)
|
||||
|
||||
// MockDevicesProvider is a mock of DevicesProvider interface.
|
||||
type MockDevicesProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDevicesProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockDevicesProviderMockRecorder is the mock recorder for MockDevicesProvider.
|
||||
type MockDevicesProviderMockRecorder struct {
|
||||
mock *MockDevicesProvider
|
||||
}
|
||||
|
||||
// NewMockDevicesProvider creates a new mock instance.
|
||||
func NewMockDevicesProvider(ctrl *gomock.Controller) *MockDevicesProvider {
|
||||
mock := &MockDevicesProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockDevicesProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDevicesProvider) EXPECT() *MockDevicesProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetAllocatableDevices mocks base method.
|
||||
func (m *MockDevicesProvider) GetAllocatableDevices() []*v10.ContainerDevices {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAllocatableDevices")
|
||||
ret0, _ := ret[0].([]*v10.ContainerDevices)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetAllocatableDevices indicates an expected call of GetAllocatableDevices.
|
||||
func (mr *MockDevicesProviderMockRecorder) GetAllocatableDevices() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllocatableDevices", reflect.TypeOf((*MockDevicesProvider)(nil).GetAllocatableDevices))
|
||||
}
|
||||
|
||||
// GetDevices mocks base method.
|
||||
func (m *MockDevicesProvider) GetDevices(podUID, containerName string) []*v10.ContainerDevices {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetDevices", podUID, containerName)
|
||||
ret0, _ := ret[0].([]*v10.ContainerDevices)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetDevices indicates an expected call of GetDevices.
|
||||
func (mr *MockDevicesProviderMockRecorder) GetDevices(podUID, containerName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDevices", reflect.TypeOf((*MockDevicesProvider)(nil).GetDevices), podUID, containerName)
|
||||
}
|
||||
|
||||
// UpdateAllocatedDevices mocks base method.
|
||||
func (m *MockDevicesProvider) UpdateAllocatedDevices() {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "UpdateAllocatedDevices")
|
||||
}
|
||||
|
||||
// UpdateAllocatedDevices indicates an expected call of UpdateAllocatedDevices.
|
||||
func (mr *MockDevicesProviderMockRecorder) UpdateAllocatedDevices() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateAllocatedDevices", reflect.TypeOf((*MockDevicesProvider)(nil).UpdateAllocatedDevices))
|
||||
}
|
||||
|
||||
// MockPodsProvider is a mock of PodsProvider interface.
|
||||
type MockPodsProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPodsProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockPodsProviderMockRecorder is the mock recorder for MockPodsProvider.
|
||||
type MockPodsProviderMockRecorder struct {
|
||||
mock *MockPodsProvider
|
||||
}
|
||||
|
||||
// NewMockPodsProvider creates a new mock instance.
|
||||
func NewMockPodsProvider(ctrl *gomock.Controller) *MockPodsProvider {
|
||||
mock := &MockPodsProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockPodsProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockPodsProvider) EXPECT() *MockPodsProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetPodByName mocks base method.
|
||||
func (m *MockPodsProvider) GetPodByName(namespace, name string) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByName", namespace, name)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByName indicates an expected call of GetPodByName.
|
||||
func (mr *MockPodsProviderMockRecorder) GetPodByName(namespace, name any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByName", reflect.TypeOf((*MockPodsProvider)(nil).GetPodByName), namespace, name)
|
||||
}
|
||||
|
||||
// GetPods mocks base method.
|
||||
func (m *MockPodsProvider) GetPods() []*v1.Pod {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPods")
|
||||
ret0, _ := ret[0].([]*v1.Pod)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetPods indicates an expected call of GetPods.
|
||||
func (mr *MockPodsProviderMockRecorder) GetPods() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPods", reflect.TypeOf((*MockPodsProvider)(nil).GetPods))
|
||||
}
|
||||
|
||||
// MockCPUsProvider is a mock of CPUsProvider interface.
|
||||
type MockCPUsProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockCPUsProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockCPUsProviderMockRecorder is the mock recorder for MockCPUsProvider.
|
||||
type MockCPUsProviderMockRecorder struct {
|
||||
mock *MockCPUsProvider
|
||||
}
|
||||
|
||||
// NewMockCPUsProvider creates a new mock instance.
|
||||
func NewMockCPUsProvider(ctrl *gomock.Controller) *MockCPUsProvider {
|
||||
mock := &MockCPUsProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockCPUsProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockCPUsProvider) EXPECT() *MockCPUsProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetAllocatableCPUs mocks base method.
|
||||
func (m *MockCPUsProvider) GetAllocatableCPUs() []int64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAllocatableCPUs")
|
||||
ret0, _ := ret[0].([]int64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetAllocatableCPUs indicates an expected call of GetAllocatableCPUs.
|
||||
func (mr *MockCPUsProviderMockRecorder) GetAllocatableCPUs() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllocatableCPUs", reflect.TypeOf((*MockCPUsProvider)(nil).GetAllocatableCPUs))
|
||||
}
|
||||
|
||||
// GetCPUs mocks base method.
|
||||
func (m *MockCPUsProvider) GetCPUs(podUID, containerName string) []int64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetCPUs", podUID, containerName)
|
||||
ret0, _ := ret[0].([]int64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetCPUs indicates an expected call of GetCPUs.
|
||||
func (mr *MockCPUsProviderMockRecorder) GetCPUs(podUID, containerName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCPUs", reflect.TypeOf((*MockCPUsProvider)(nil).GetCPUs), podUID, containerName)
|
||||
}
|
||||
|
||||
// MockMemoryProvider is a mock of MemoryProvider interface.
|
||||
type MockMemoryProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockMemoryProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockMemoryProviderMockRecorder is the mock recorder for MockMemoryProvider.
|
||||
type MockMemoryProviderMockRecorder struct {
|
||||
mock *MockMemoryProvider
|
||||
}
|
||||
|
||||
// NewMockMemoryProvider creates a new mock instance.
|
||||
func NewMockMemoryProvider(ctrl *gomock.Controller) *MockMemoryProvider {
|
||||
mock := &MockMemoryProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockMemoryProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockMemoryProvider) EXPECT() *MockMemoryProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetAllocatableMemory mocks base method.
|
||||
func (m *MockMemoryProvider) GetAllocatableMemory() []*v10.ContainerMemory {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAllocatableMemory")
|
||||
ret0, _ := ret[0].([]*v10.ContainerMemory)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetAllocatableMemory indicates an expected call of GetAllocatableMemory.
|
||||
func (mr *MockMemoryProviderMockRecorder) GetAllocatableMemory() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllocatableMemory", reflect.TypeOf((*MockMemoryProvider)(nil).GetAllocatableMemory))
|
||||
}
|
||||
|
||||
// GetMemory mocks base method.
|
||||
func (m *MockMemoryProvider) GetMemory(podUID, containerName string) []*v10.ContainerMemory {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetMemory", podUID, containerName)
|
||||
ret0, _ := ret[0].([]*v10.ContainerMemory)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetMemory indicates an expected call of GetMemory.
|
||||
func (mr *MockMemoryProviderMockRecorder) GetMemory(podUID, containerName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMemory", reflect.TypeOf((*MockMemoryProvider)(nil).GetMemory), podUID, containerName)
|
||||
}
|
||||
|
||||
// MockDynamicResourcesProvider is a mock of DynamicResourcesProvider interface.
|
||||
type MockDynamicResourcesProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDynamicResourcesProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockDynamicResourcesProviderMockRecorder is the mock recorder for MockDynamicResourcesProvider.
|
||||
type MockDynamicResourcesProviderMockRecorder struct {
|
||||
mock *MockDynamicResourcesProvider
|
||||
}
|
||||
|
||||
// NewMockDynamicResourcesProvider creates a new mock instance.
|
||||
func NewMockDynamicResourcesProvider(ctrl *gomock.Controller) *MockDynamicResourcesProvider {
|
||||
mock := &MockDynamicResourcesProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockDynamicResourcesProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDynamicResourcesProvider) EXPECT() *MockDynamicResourcesProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetDynamicResources mocks base method.
|
||||
func (m *MockDynamicResourcesProvider) GetDynamicResources(pod *v1.Pod, container *v1.Container) []*v10.DynamicResource {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetDynamicResources", pod, container)
|
||||
ret0, _ := ret[0].([]*v10.DynamicResource)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetDynamicResources indicates an expected call of GetDynamicResources.
|
||||
func (mr *MockDynamicResourcesProviderMockRecorder) GetDynamicResources(pod, container any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDynamicResources", reflect.TypeOf((*MockDynamicResourcesProvider)(nil).GetDynamicResources), pod, container)
|
||||
}
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=types.go -destination=testing/provider_mock.go -package=testing DevicesProvider,PodsProvider,CPUsProvider,MemoryProvider
|
||||
//go:generate mockery
|
||||
package podresources
|
||||
|
||||
import (
|
||||
|
||||
10
pkg/kubelet/cadvisor/.mockery.yaml
Normal file
10
pkg/kubelet/cadvisor/.mockery.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: cadvisor_mock.go
|
||||
boilerplate-file: ../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/cadvisor:
|
||||
interfaces:
|
||||
Interface:
|
||||
@@ -14,231 +14,538 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: types.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=types.go -destination=testing/cadvisor_mock.go -package=testing Interface
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
|
||||
v1 "github.com/google/cadvisor/info/v1"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
v2 "github.com/google/cadvisor/info/v2"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockInterface is a mock of Interface interface.
|
||||
// MockInterface is an autogenerated mock type for the Interface type
|
||||
type MockInterface struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockInterfaceMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockInterfaceMockRecorder is the mock recorder for MockInterface.
|
||||
type MockInterfaceMockRecorder struct {
|
||||
mock *MockInterface
|
||||
type MockInterface_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockInterface creates a new mock instance.
|
||||
func NewMockInterface(ctrl *gomock.Controller) *MockInterface {
|
||||
mock := &MockInterface{ctrl: ctrl}
|
||||
mock.recorder = &MockInterfaceMockRecorder{mock}
|
||||
func (_m *MockInterface) EXPECT() *MockInterface_Expecter {
|
||||
return &MockInterface_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// ContainerFsInfo provides a mock function with given fields:
|
||||
func (_m *MockInterface) ContainerFsInfo() (v2.FsInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ContainerFsInfo")
|
||||
}
|
||||
|
||||
var r0 v2.FsInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (v2.FsInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() v2.FsInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(v2.FsInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_ContainerFsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerFsInfo'
|
||||
type MockInterface_ContainerFsInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ContainerFsInfo is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) ContainerFsInfo() *MockInterface_ContainerFsInfo_Call {
|
||||
return &MockInterface_ContainerFsInfo_Call{Call: _e.mock.On("ContainerFsInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerFsInfo_Call) Run(run func()) *MockInterface_ContainerFsInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerFsInfo_Call) Return(_a0 v2.FsInfo, _a1 error) *MockInterface_ContainerFsInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerFsInfo_Call) RunAndReturn(run func() (v2.FsInfo, error)) *MockInterface_ContainerFsInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ContainerInfoV2 provides a mock function with given fields: name, options
|
||||
func (_m *MockInterface) ContainerInfoV2(name string, options v2.RequestOptions) (map[string]v2.ContainerInfo, error) {
|
||||
ret := _m.Called(name, options)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ContainerInfoV2")
|
||||
}
|
||||
|
||||
var r0 map[string]v2.ContainerInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string, v2.RequestOptions) (map[string]v2.ContainerInfo, error)); ok {
|
||||
return rf(name, options)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, v2.RequestOptions) map[string]v2.ContainerInfo); ok {
|
||||
r0 = rf(name, options)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(map[string]v2.ContainerInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, v2.RequestOptions) error); ok {
|
||||
r1 = rf(name, options)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_ContainerInfoV2_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerInfoV2'
|
||||
type MockInterface_ContainerInfoV2_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ContainerInfoV2 is a helper method to define mock.On call
|
||||
// - name string
|
||||
// - options v2.RequestOptions
|
||||
func (_e *MockInterface_Expecter) ContainerInfoV2(name interface{}, options interface{}) *MockInterface_ContainerInfoV2_Call {
|
||||
return &MockInterface_ContainerInfoV2_Call{Call: _e.mock.On("ContainerInfoV2", name, options)}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerInfoV2_Call) Run(run func(name string, options v2.RequestOptions)) *MockInterface_ContainerInfoV2_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(v2.RequestOptions))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerInfoV2_Call) Return(_a0 map[string]v2.ContainerInfo, _a1 error) *MockInterface_ContainerInfoV2_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ContainerInfoV2_Call) RunAndReturn(run func(string, v2.RequestOptions) (map[string]v2.ContainerInfo, error)) *MockInterface_ContainerInfoV2_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetDirFsInfo provides a mock function with given fields: path
|
||||
func (_m *MockInterface) GetDirFsInfo(path string) (v2.FsInfo, error) {
|
||||
ret := _m.Called(path)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetDirFsInfo")
|
||||
}
|
||||
|
||||
var r0 v2.FsInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string) (v2.FsInfo, error)); ok {
|
||||
return rf(path)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) v2.FsInfo); ok {
|
||||
r0 = rf(path)
|
||||
} else {
|
||||
r0 = ret.Get(0).(v2.FsInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(path)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_GetDirFsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDirFsInfo'
|
||||
type MockInterface_GetDirFsInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetDirFsInfo is a helper method to define mock.On call
|
||||
// - path string
|
||||
func (_e *MockInterface_Expecter) GetDirFsInfo(path interface{}) *MockInterface_GetDirFsInfo_Call {
|
||||
return &MockInterface_GetDirFsInfo_Call{Call: _e.mock.On("GetDirFsInfo", path)}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetDirFsInfo_Call) Run(run func(path string)) *MockInterface_GetDirFsInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetDirFsInfo_Call) Return(_a0 v2.FsInfo, _a1 error) *MockInterface_GetDirFsInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetDirFsInfo_Call) RunAndReturn(run func(string) (v2.FsInfo, error)) *MockInterface_GetDirFsInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetRequestedContainersInfo provides a mock function with given fields: containerName, options
|
||||
func (_m *MockInterface) GetRequestedContainersInfo(containerName string, options v2.RequestOptions) (map[string]*v1.ContainerInfo, error) {
|
||||
ret := _m.Called(containerName, options)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetRequestedContainersInfo")
|
||||
}
|
||||
|
||||
var r0 map[string]*v1.ContainerInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string, v2.RequestOptions) (map[string]*v1.ContainerInfo, error)); ok {
|
||||
return rf(containerName, options)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, v2.RequestOptions) map[string]*v1.ContainerInfo); ok {
|
||||
r0 = rf(containerName, options)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(map[string]*v1.ContainerInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, v2.RequestOptions) error); ok {
|
||||
r1 = rf(containerName, options)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_GetRequestedContainersInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRequestedContainersInfo'
|
||||
type MockInterface_GetRequestedContainersInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetRequestedContainersInfo is a helper method to define mock.On call
|
||||
// - containerName string
|
||||
// - options v2.RequestOptions
|
||||
func (_e *MockInterface_Expecter) GetRequestedContainersInfo(containerName interface{}, options interface{}) *MockInterface_GetRequestedContainersInfo_Call {
|
||||
return &MockInterface_GetRequestedContainersInfo_Call{Call: _e.mock.On("GetRequestedContainersInfo", containerName, options)}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetRequestedContainersInfo_Call) Run(run func(containerName string, options v2.RequestOptions)) *MockInterface_GetRequestedContainersInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(v2.RequestOptions))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetRequestedContainersInfo_Call) Return(_a0 map[string]*v1.ContainerInfo, _a1 error) *MockInterface_GetRequestedContainersInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_GetRequestedContainersInfo_Call) RunAndReturn(run func(string, v2.RequestOptions) (map[string]*v1.ContainerInfo, error)) *MockInterface_GetRequestedContainersInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ImagesFsInfo provides a mock function with given fields:
|
||||
func (_m *MockInterface) ImagesFsInfo() (v2.FsInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ImagesFsInfo")
|
||||
}
|
||||
|
||||
var r0 v2.FsInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (v2.FsInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() v2.FsInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(v2.FsInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_ImagesFsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ImagesFsInfo'
|
||||
type MockInterface_ImagesFsInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ImagesFsInfo is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) ImagesFsInfo() *MockInterface_ImagesFsInfo_Call {
|
||||
return &MockInterface_ImagesFsInfo_Call{Call: _e.mock.On("ImagesFsInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ImagesFsInfo_Call) Run(run func()) *MockInterface_ImagesFsInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ImagesFsInfo_Call) Return(_a0 v2.FsInfo, _a1 error) *MockInterface_ImagesFsInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_ImagesFsInfo_Call) RunAndReturn(run func() (v2.FsInfo, error)) *MockInterface_ImagesFsInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// MachineInfo provides a mock function with given fields:
|
||||
func (_m *MockInterface) MachineInfo() (*v1.MachineInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for MachineInfo")
|
||||
}
|
||||
|
||||
var r0 *v1.MachineInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (*v1.MachineInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() *v1.MachineInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.MachineInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_MachineInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MachineInfo'
|
||||
type MockInterface_MachineInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// MachineInfo is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) MachineInfo() *MockInterface_MachineInfo_Call {
|
||||
return &MockInterface_MachineInfo_Call{Call: _e.mock.On("MachineInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_MachineInfo_Call) Run(run func()) *MockInterface_MachineInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_MachineInfo_Call) Return(_a0 *v1.MachineInfo, _a1 error) *MockInterface_MachineInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_MachineInfo_Call) RunAndReturn(run func() (*v1.MachineInfo, error)) *MockInterface_MachineInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// RootFsInfo provides a mock function with given fields:
|
||||
func (_m *MockInterface) RootFsInfo() (v2.FsInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for RootFsInfo")
|
||||
}
|
||||
|
||||
var r0 v2.FsInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (v2.FsInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() v2.FsInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(v2.FsInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_RootFsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RootFsInfo'
|
||||
type MockInterface_RootFsInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// RootFsInfo is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) RootFsInfo() *MockInterface_RootFsInfo_Call {
|
||||
return &MockInterface_RootFsInfo_Call{Call: _e.mock.On("RootFsInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_RootFsInfo_Call) Run(run func()) *MockInterface_RootFsInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_RootFsInfo_Call) Return(_a0 v2.FsInfo, _a1 error) *MockInterface_RootFsInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_RootFsInfo_Call) RunAndReturn(run func() (v2.FsInfo, error)) *MockInterface_RootFsInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields:
|
||||
func (_m *MockInterface) Start() error {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Start")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func() error); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockInterface_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type MockInterface_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) Start() *MockInterface_Start_Call {
|
||||
return &MockInterface_Start_Call{Call: _e.mock.On("Start")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_Start_Call) Run(run func()) *MockInterface_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_Start_Call) Return(_a0 error) *MockInterface_Start_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_Start_Call) RunAndReturn(run func() error) *MockInterface_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// VersionInfo provides a mock function with given fields:
|
||||
func (_m *MockInterface) VersionInfo() (*v1.VersionInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for VersionInfo")
|
||||
}
|
||||
|
||||
var r0 *v1.VersionInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (*v1.VersionInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() *v1.VersionInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.VersionInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockInterface_VersionInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'VersionInfo'
|
||||
type MockInterface_VersionInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// VersionInfo is a helper method to define mock.On call
|
||||
func (_e *MockInterface_Expecter) VersionInfo() *MockInterface_VersionInfo_Call {
|
||||
return &MockInterface_VersionInfo_Call{Call: _e.mock.On("VersionInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockInterface_VersionInfo_Call) Run(run func()) *MockInterface_VersionInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_VersionInfo_Call) Return(_a0 *v1.VersionInfo, _a1 error) *MockInterface_VersionInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInterface_VersionInfo_Call) RunAndReturn(run func() (*v1.VersionInfo, error)) *MockInterface_VersionInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockInterface creates a new instance of MockInterface. 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 NewMockInterface(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockInterface {
|
||||
mock := &MockInterface{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockInterface) EXPECT() *MockInterfaceMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ContainerFsInfo mocks base method.
|
||||
func (m *MockInterface) ContainerFsInfo() (v2.FsInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ContainerFsInfo")
|
||||
ret0, _ := ret[0].(v2.FsInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ContainerFsInfo indicates an expected call of ContainerFsInfo.
|
||||
func (mr *MockInterfaceMockRecorder) ContainerFsInfo() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerFsInfo", reflect.TypeOf((*MockInterface)(nil).ContainerFsInfo))
|
||||
}
|
||||
|
||||
// ContainerInfoV2 mocks base method.
|
||||
func (m *MockInterface) ContainerInfoV2(name string, options v2.RequestOptions) (map[string]v2.ContainerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ContainerInfoV2", name, options)
|
||||
ret0, _ := ret[0].(map[string]v2.ContainerInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ContainerInfoV2 indicates an expected call of ContainerInfoV2.
|
||||
func (mr *MockInterfaceMockRecorder) ContainerInfoV2(name, options any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerInfoV2", reflect.TypeOf((*MockInterface)(nil).ContainerInfoV2), name, options)
|
||||
}
|
||||
|
||||
// GetDirFsInfo mocks base method.
|
||||
func (m *MockInterface) GetDirFsInfo(path string) (v2.FsInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetDirFsInfo", path)
|
||||
ret0, _ := ret[0].(v2.FsInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetDirFsInfo indicates an expected call of GetDirFsInfo.
|
||||
func (mr *MockInterfaceMockRecorder) GetDirFsInfo(path any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDirFsInfo", reflect.TypeOf((*MockInterface)(nil).GetDirFsInfo), path)
|
||||
}
|
||||
|
||||
// GetRequestedContainersInfo mocks base method.
|
||||
func (m *MockInterface) GetRequestedContainersInfo(containerName string, options v2.RequestOptions) (map[string]*v1.ContainerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetRequestedContainersInfo", containerName, options)
|
||||
ret0, _ := ret[0].(map[string]*v1.ContainerInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetRequestedContainersInfo indicates an expected call of GetRequestedContainersInfo.
|
||||
func (mr *MockInterfaceMockRecorder) GetRequestedContainersInfo(containerName, options any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedContainersInfo", reflect.TypeOf((*MockInterface)(nil).GetRequestedContainersInfo), containerName, options)
|
||||
}
|
||||
|
||||
// ImagesFsInfo mocks base method.
|
||||
func (m *MockInterface) ImagesFsInfo() (v2.FsInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ImagesFsInfo")
|
||||
ret0, _ := ret[0].(v2.FsInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ImagesFsInfo indicates an expected call of ImagesFsInfo.
|
||||
func (mr *MockInterfaceMockRecorder) ImagesFsInfo() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImagesFsInfo", reflect.TypeOf((*MockInterface)(nil).ImagesFsInfo))
|
||||
}
|
||||
|
||||
// MachineInfo mocks base method.
|
||||
func (m *MockInterface) MachineInfo() (*v1.MachineInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MachineInfo")
|
||||
ret0, _ := ret[0].(*v1.MachineInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// MachineInfo indicates an expected call of MachineInfo.
|
||||
func (mr *MockInterfaceMockRecorder) MachineInfo() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MachineInfo", reflect.TypeOf((*MockInterface)(nil).MachineInfo))
|
||||
}
|
||||
|
||||
// RootFsInfo mocks base method.
|
||||
func (m *MockInterface) RootFsInfo() (v2.FsInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "RootFsInfo")
|
||||
ret0, _ := ret[0].(v2.FsInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// RootFsInfo indicates an expected call of RootFsInfo.
|
||||
func (mr *MockInterfaceMockRecorder) RootFsInfo() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RootFsInfo", reflect.TypeOf((*MockInterface)(nil).RootFsInfo))
|
||||
}
|
||||
|
||||
// Start mocks base method.
|
||||
func (m *MockInterface) Start() error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Start")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Start indicates an expected call of Start.
|
||||
func (mr *MockInterfaceMockRecorder) Start() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockInterface)(nil).Start))
|
||||
}
|
||||
|
||||
// VersionInfo mocks base method.
|
||||
func (m *MockInterface) VersionInfo() (*v1.VersionInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "VersionInfo")
|
||||
ret0, _ := ret[0].(*v1.VersionInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// VersionInfo indicates an expected call of VersionInfo.
|
||||
func (mr *MockInterfaceMockRecorder) VersionInfo() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VersionInfo", reflect.TypeOf((*MockInterface)(nil).VersionInfo))
|
||||
}
|
||||
|
||||
// MockImageFsInfoProvider is a mock of ImageFsInfoProvider interface.
|
||||
type MockImageFsInfoProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockImageFsInfoProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockImageFsInfoProviderMockRecorder is the mock recorder for MockImageFsInfoProvider.
|
||||
type MockImageFsInfoProviderMockRecorder struct {
|
||||
mock *MockImageFsInfoProvider
|
||||
}
|
||||
|
||||
// NewMockImageFsInfoProvider creates a new mock instance.
|
||||
func NewMockImageFsInfoProvider(ctrl *gomock.Controller) *MockImageFsInfoProvider {
|
||||
mock := &MockImageFsInfoProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockImageFsInfoProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockImageFsInfoProvider) EXPECT() *MockImageFsInfoProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ContainerFsInfoLabel mocks base method.
|
||||
func (m *MockImageFsInfoProvider) ContainerFsInfoLabel() (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ContainerFsInfoLabel")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ContainerFsInfoLabel indicates an expected call of ContainerFsInfoLabel.
|
||||
func (mr *MockImageFsInfoProviderMockRecorder) ContainerFsInfoLabel() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerFsInfoLabel", reflect.TypeOf((*MockImageFsInfoProvider)(nil).ContainerFsInfoLabel))
|
||||
}
|
||||
|
||||
// ImageFsInfoLabel mocks base method.
|
||||
func (m *MockImageFsInfoProvider) ImageFsInfoLabel() (string, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ImageFsInfoLabel")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ImageFsInfoLabel indicates an expected call of ImageFsInfoLabel.
|
||||
func (mr *MockImageFsInfoProviderMockRecorder) ImageFsInfoLabel() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageFsInfoLabel", reflect.TypeOf((*MockImageFsInfoProvider)(nil).ImageFsInfoLabel))
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=types.go -destination=testing/cadvisor_mock.go -package=testing Interface
|
||||
//go:generate mockery
|
||||
package cadvisor
|
||||
|
||||
import (
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
"time"
|
||||
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -177,17 +176,13 @@ func TestSoftRequirementsValidationSuccess(t *testing.T) {
|
||||
func TestGetCapacity(t *testing.T) {
|
||||
ephemeralStorageFromCapacity := int64(2000)
|
||||
ephemeralStorageFromCadvisor := int64(8000)
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockCtrlError := gomock.NewController(t)
|
||||
defer mockCtrlError.Finish()
|
||||
|
||||
mockCadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor := cadvisortest.NewMockInterface(t)
|
||||
rootfs := cadvisorapiv2.FsInfo{
|
||||
Capacity: 8000,
|
||||
}
|
||||
mockCadvisor.EXPECT().RootFsInfo().Return(rootfs, nil)
|
||||
mockCadvisorError := cadvisortest.NewMockInterface(mockCtrlError)
|
||||
mockCadvisorError := cadvisortest.NewMockInterface(t)
|
||||
mockCadvisorError.EXPECT().RootFsInfo().Return(cadvisorapiv2.FsInfo{}, errors.New("Unable to get rootfs data from cAdvisor interface"))
|
||||
cases := []struct {
|
||||
name string
|
||||
|
||||
18
pkg/kubelet/container/.mockery.yaml
Normal file
18
pkg/kubelet/container/.mockery.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: "mock_{{.InterfaceName | snakecase}}.go"
|
||||
boilerplate-file: ../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
io/fs:
|
||||
interfaces:
|
||||
DirEntry:
|
||||
config:
|
||||
filename: mockdirentry.go
|
||||
k8s.io/kubernetes/pkg/kubelet/container:
|
||||
interfaces:
|
||||
Runtime:
|
||||
config:
|
||||
filename: runtime_mock.go
|
||||
RuntimeCache:
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=runtime.go -destination=testing/runtime_mock.go -package=testing Runtime
|
||||
//go:generate mockery
|
||||
package container
|
||||
|
||||
import (
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=runtime_cache.go -destination=testing/mock_runtime_cache.go -package=testing RuntimeCache
|
||||
//go:generate mockery
|
||||
package container
|
||||
|
||||
import (
|
||||
|
||||
@@ -14,112 +14,148 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: runtime_cache.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=runtime_cache.go -destination=testing/mock_runtime_cache.go -package=testing RuntimeCache
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
container "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
time "time"
|
||||
)
|
||||
|
||||
// MockRuntimeCache is a mock of RuntimeCache interface.
|
||||
// MockRuntimeCache is an autogenerated mock type for the RuntimeCache type
|
||||
type MockRuntimeCache struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockRuntimeCacheMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockRuntimeCacheMockRecorder is the mock recorder for MockRuntimeCache.
|
||||
type MockRuntimeCacheMockRecorder struct {
|
||||
mock *MockRuntimeCache
|
||||
type MockRuntimeCache_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockRuntimeCache creates a new mock instance.
|
||||
func NewMockRuntimeCache(ctrl *gomock.Controller) *MockRuntimeCache {
|
||||
mock := &MockRuntimeCache{ctrl: ctrl}
|
||||
mock.recorder = &MockRuntimeCacheMockRecorder{mock}
|
||||
func (_m *MockRuntimeCache) EXPECT() *MockRuntimeCache_Expecter {
|
||||
return &MockRuntimeCache_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// ForceUpdateIfOlder provides a mock function with given fields: _a0, _a1
|
||||
func (_m *MockRuntimeCache) ForceUpdateIfOlder(_a0 context.Context, _a1 time.Time) error {
|
||||
ret := _m.Called(_a0, _a1)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ForceUpdateIfOlder")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, time.Time) error); ok {
|
||||
r0 = rf(_a0, _a1)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockRuntimeCache_ForceUpdateIfOlder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForceUpdateIfOlder'
|
||||
type MockRuntimeCache_ForceUpdateIfOlder_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ForceUpdateIfOlder is a helper method to define mock.On call
|
||||
// - _a0 context.Context
|
||||
// - _a1 time.Time
|
||||
func (_e *MockRuntimeCache_Expecter) ForceUpdateIfOlder(_a0 interface{}, _a1 interface{}) *MockRuntimeCache_ForceUpdateIfOlder_Call {
|
||||
return &MockRuntimeCache_ForceUpdateIfOlder_Call{Call: _e.mock.On("ForceUpdateIfOlder", _a0, _a1)}
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_ForceUpdateIfOlder_Call) Run(run func(_a0 context.Context, _a1 time.Time)) *MockRuntimeCache_ForceUpdateIfOlder_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(time.Time))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_ForceUpdateIfOlder_Call) Return(_a0 error) *MockRuntimeCache_ForceUpdateIfOlder_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_ForceUpdateIfOlder_Call) RunAndReturn(run func(context.Context, time.Time) error) *MockRuntimeCache_ForceUpdateIfOlder_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPods provides a mock function with given fields: _a0
|
||||
func (_m *MockRuntimeCache) GetPods(_a0 context.Context) ([]*container.Pod, error) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPods")
|
||||
}
|
||||
|
||||
var r0 []*container.Pod
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context) ([]*container.Pod, error)); ok {
|
||||
return rf(_a0)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(context.Context) []*container.Pod); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*container.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
||||
r1 = rf(_a0)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockRuntimeCache_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods'
|
||||
type MockRuntimeCache_GetPods_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPods is a helper method to define mock.On call
|
||||
// - _a0 context.Context
|
||||
func (_e *MockRuntimeCache_Expecter) GetPods(_a0 interface{}) *MockRuntimeCache_GetPods_Call {
|
||||
return &MockRuntimeCache_GetPods_Call{Call: _e.mock.On("GetPods", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_GetPods_Call) Run(run func(_a0 context.Context)) *MockRuntimeCache_GetPods_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_GetPods_Call) Return(_a0 []*container.Pod, _a1 error) *MockRuntimeCache_GetPods_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockRuntimeCache_GetPods_Call) RunAndReturn(run func(context.Context) ([]*container.Pod, error)) *MockRuntimeCache_GetPods_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// 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 NewMockRuntimeCache(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockRuntimeCache {
|
||||
mock := &MockRuntimeCache{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockRuntimeCache) EXPECT() *MockRuntimeCacheMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ForceUpdateIfOlder mocks base method.
|
||||
func (m *MockRuntimeCache) ForceUpdateIfOlder(arg0 context.Context, arg1 time.Time) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ForceUpdateIfOlder", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ForceUpdateIfOlder indicates an expected call of ForceUpdateIfOlder.
|
||||
func (mr *MockRuntimeCacheMockRecorder) ForceUpdateIfOlder(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForceUpdateIfOlder", reflect.TypeOf((*MockRuntimeCache)(nil).ForceUpdateIfOlder), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetPods mocks base method.
|
||||
func (m *MockRuntimeCache) GetPods(arg0 context.Context) ([]*container.Pod, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPods", arg0)
|
||||
ret0, _ := ret[0].([]*container.Pod)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPods indicates an expected call of GetPods.
|
||||
func (mr *MockRuntimeCacheMockRecorder) GetPods(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPods", reflect.TypeOf((*MockRuntimeCache)(nil).GetPods), arg0)
|
||||
}
|
||||
|
||||
// MockpodsGetter is a mock of podsGetter interface.
|
||||
type MockpodsGetter struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockpodsGetterMockRecorder
|
||||
}
|
||||
|
||||
// MockpodsGetterMockRecorder is the mock recorder for MockpodsGetter.
|
||||
type MockpodsGetterMockRecorder struct {
|
||||
mock *MockpodsGetter
|
||||
}
|
||||
|
||||
// NewMockpodsGetter creates a new mock instance.
|
||||
func NewMockpodsGetter(ctrl *gomock.Controller) *MockpodsGetter {
|
||||
mock := &MockpodsGetter{ctrl: ctrl}
|
||||
mock.recorder = &MockpodsGetterMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockpodsGetter) EXPECT() *MockpodsGetterMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetPods mocks base method.
|
||||
func (m *MockpodsGetter) GetPods(arg0 context.Context, arg1 bool) ([]*container.Pod, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPods", arg0, arg1)
|
||||
ret0, _ := ret[0].([]*container.Pod)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPods indicates an expected call of GetPods.
|
||||
func (mr *MockpodsGetterMockRecorder) GetPods(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPods", reflect.TypeOf((*MockpodsGetter)(nil).GetPods), arg0, arg1)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2022 The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -14,94 +14,231 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen.
|
||||
// Source: os (interfaces: DirEntry)
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
fs "io/fs"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// MockDirEntry is a mock of DirEntry interface.
|
||||
// MockDirEntry is an autogenerated mock type for the DirEntry type
|
||||
type MockDirEntry struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDirEntryMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockDirEntryMockRecorder is the mock recorder for MockDirEntry.
|
||||
type MockDirEntryMockRecorder struct {
|
||||
mock *MockDirEntry
|
||||
type MockDirEntry_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockDirEntry creates a new mock instance.
|
||||
func NewMockDirEntry(ctrl *gomock.Controller) *MockDirEntry {
|
||||
mock := &MockDirEntry{ctrl: ctrl}
|
||||
mock.recorder = &MockDirEntryMockRecorder{mock}
|
||||
func (_m *MockDirEntry) EXPECT() *MockDirEntry_Expecter {
|
||||
return &MockDirEntry_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Info provides a mock function with given fields:
|
||||
func (_m *MockDirEntry) Info() (fs.FileInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Info")
|
||||
}
|
||||
|
||||
var r0 fs.FileInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (fs.FileInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() fs.FileInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(fs.FileInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockDirEntry_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'
|
||||
type MockDirEntry_Info_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Info is a helper method to define mock.On call
|
||||
func (_e *MockDirEntry_Expecter) Info() *MockDirEntry_Info_Call {
|
||||
return &MockDirEntry_Info_Call{Call: _e.mock.On("Info")}
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Info_Call) Run(run func()) *MockDirEntry_Info_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Info_Call) Return(_a0 fs.FileInfo, _a1 error) *MockDirEntry_Info_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Info_Call) RunAndReturn(run func() (fs.FileInfo, error)) *MockDirEntry_Info_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// IsDir provides a mock function with given fields:
|
||||
func (_m *MockDirEntry) IsDir() bool {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for IsDir")
|
||||
}
|
||||
|
||||
var r0 bool
|
||||
if rf, ok := ret.Get(0).(func() bool); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDirEntry_IsDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDir'
|
||||
type MockDirEntry_IsDir_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// IsDir is a helper method to define mock.On call
|
||||
func (_e *MockDirEntry_Expecter) IsDir() *MockDirEntry_IsDir_Call {
|
||||
return &MockDirEntry_IsDir_Call{Call: _e.mock.On("IsDir")}
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_IsDir_Call) Run(run func()) *MockDirEntry_IsDir_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_IsDir_Call) Return(_a0 bool) *MockDirEntry_IsDir_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_IsDir_Call) RunAndReturn(run func() bool) *MockDirEntry_IsDir_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Name provides a mock function with given fields:
|
||||
func (_m *MockDirEntry) Name() string {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Name")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDirEntry_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
|
||||
type MockDirEntry_Name_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Name is a helper method to define mock.On call
|
||||
func (_e *MockDirEntry_Expecter) Name() *MockDirEntry_Name_Call {
|
||||
return &MockDirEntry_Name_Call{Call: _e.mock.On("Name")}
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Name_Call) Run(run func()) *MockDirEntry_Name_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Name_Call) Return(_a0 string) *MockDirEntry_Name_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Name_Call) RunAndReturn(run func() string) *MockDirEntry_Name_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Type provides a mock function with given fields:
|
||||
func (_m *MockDirEntry) Type() fs.FileMode {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Type")
|
||||
}
|
||||
|
||||
var r0 fs.FileMode
|
||||
if rf, ok := ret.Get(0).(func() fs.FileMode); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(fs.FileMode)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockDirEntry_Type_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Type'
|
||||
type MockDirEntry_Type_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Type is a helper method to define mock.On call
|
||||
func (_e *MockDirEntry_Expecter) Type() *MockDirEntry_Type_Call {
|
||||
return &MockDirEntry_Type_Call{Call: _e.mock.On("Type")}
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Type_Call) Run(run func()) *MockDirEntry_Type_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Type_Call) Return(_a0 fs.FileMode) *MockDirEntry_Type_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockDirEntry_Type_Call) RunAndReturn(run func() fs.FileMode) *MockDirEntry_Type_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// 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 NewMockDirEntry(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockDirEntry {
|
||||
mock := &MockDirEntry{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDirEntry) EXPECT() *MockDirEntryMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Info mocks base method.
|
||||
func (m *MockDirEntry) Info() (fs.FileInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Info")
|
||||
ret0, _ := ret[0].(fs.FileInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Info indicates an expected call of Info.
|
||||
func (mr *MockDirEntryMockRecorder) Info() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockDirEntry)(nil).Info))
|
||||
}
|
||||
|
||||
// IsDir mocks base method.
|
||||
func (m *MockDirEntry) IsDir() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsDir")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsDir indicates an expected call of IsDir.
|
||||
func (mr *MockDirEntryMockRecorder) IsDir() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDir", reflect.TypeOf((*MockDirEntry)(nil).IsDir))
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockDirEntry) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Name")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Name indicates an expected call of Name.
|
||||
func (mr *MockDirEntryMockRecorder) Name() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockDirEntry)(nil).Name))
|
||||
}
|
||||
|
||||
// Type mocks base method.
|
||||
func (m *MockDirEntry) Type() fs.FileMode {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Type")
|
||||
ret0, _ := ret[0].(fs.FileMode)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Type indicates an expected call of Type.
|
||||
func (mr *MockDirEntryMockRecorder) Type() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Type", reflect.TypeOf((*MockDirEntry)(nil).Type))
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
12
pkg/kubelet/eviction/.mockery.yaml
Normal file
12
pkg/kubelet/eviction/.mockery.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
dir: .
|
||||
filename: "mock_{{.InterfaceName | snakecase}}_test.go"
|
||||
boilerplate-file: ../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
inpackage: true
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/eviction:
|
||||
interfaces:
|
||||
CgroupNotifier:
|
||||
NotifierFactory:
|
||||
ThresholdNotifier:
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -2976,10 +2975,7 @@ func TestUpdateMemcgThreshold(t *testing.T) {
|
||||
}
|
||||
summaryProvider := &fakeSummaryProvider{result: makeMemoryStats("2Gi", map[*v1.Pod]statsapi.PodStats{})}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
thresholdNotifier := NewMockThresholdNotifier(mockCtrl)
|
||||
thresholdNotifier := NewMockThresholdNotifier(t)
|
||||
thresholdNotifier.EXPECT().UpdateThreshold(summaryProvider.result).Return(nil).Times(2)
|
||||
|
||||
manager := &managerImpl{
|
||||
@@ -3019,7 +3015,7 @@ func TestUpdateMemcgThreshold(t *testing.T) {
|
||||
}
|
||||
|
||||
// new memory threshold notifier that returns an error
|
||||
thresholdNotifier = NewMockThresholdNotifier(mockCtrl)
|
||||
thresholdNotifier = NewMockThresholdNotifier(t)
|
||||
thresholdNotifier.EXPECT().UpdateThreshold(summaryProvider.result).Return(fmt.Errorf("error updating threshold")).Times(1)
|
||||
thresholdNotifier.EXPECT().Description().Return("mock thresholdNotifier").Times(1)
|
||||
manager.thresholdNotifiers = []ThresholdNotifier{thresholdNotifier}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
statsapi "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
|
||||
evictionapi "k8s.io/kubernetes/pkg/kubelet/eviction/api"
|
||||
@@ -130,18 +129,15 @@ func TestUpdateThreshold(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.description, func(t *testing.T) {
|
||||
notifierFactory := NewMockNotifierFactory(mockCtrl)
|
||||
notifier := NewMockCgroupNotifier(mockCtrl)
|
||||
notifierFactory := NewMockNotifierFactory(t)
|
||||
notifier := NewMockCgroupNotifier(t)
|
||||
|
||||
m := newTestMemoryThresholdNotifier(tc.evictionThreshold, notifierFactory, nil)
|
||||
notifierFactory.EXPECT().NewCgroupNotifier(testCgroupPath, memoryUsageAttribute, tc.expectedThreshold.Value()).Return(notifier, tc.updateThresholdErr).Times(1)
|
||||
var events chan<- struct{} = m.events
|
||||
notifier.EXPECT().Start(events).Return().AnyTimes()
|
||||
notifier.EXPECT().Start(events).Return().Maybe()
|
||||
err := m.UpdateThreshold(nodeSummary(tc.available, tc.workingSet, tc.usage, isAllocatableEvictionThreshold(tc.evictionThreshold)))
|
||||
if err != nil && !tc.expectErr {
|
||||
t.Errorf("Unexpected error updating threshold: %v", err)
|
||||
@@ -161,10 +157,8 @@ func TestStart(t *testing.T) {
|
||||
Quantity: &noResources,
|
||||
},
|
||||
}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
notifierFactory := NewMockNotifierFactory(mockCtrl)
|
||||
notifier := NewMockCgroupNotifier(mockCtrl)
|
||||
notifierFactory := NewMockNotifierFactory(t)
|
||||
notifier := NewMockCgroupNotifier(t)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(4)
|
||||
@@ -174,7 +168,7 @@ func TestStart(t *testing.T) {
|
||||
notifierFactory.EXPECT().NewCgroupNotifier(testCgroupPath, memoryUsageAttribute, int64(0)).Return(notifier, nil).Times(1)
|
||||
|
||||
var events chan<- struct{} = m.events
|
||||
notifier.EXPECT().Start(events).DoAndReturn(func(events chan<- struct{}) {
|
||||
notifier.EXPECT().Start(events).Run(func(events chan<- struct{}) {
|
||||
for i := 0; i < 4; i++ {
|
||||
events <- struct{}{}
|
||||
}
|
||||
|
||||
113
pkg/kubelet/eviction/mock_cgroup_notifier_test.go
Normal file
113
pkg/kubelet/eviction/mock_cgroup_notifier_test.go
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package eviction
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
|
||||
// MockCgroupNotifier is an autogenerated mock type for the CgroupNotifier type
|
||||
type MockCgroupNotifier struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockCgroupNotifier_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockCgroupNotifier) EXPECT() *MockCgroupNotifier_Expecter {
|
||||
return &MockCgroupNotifier_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields: eventCh
|
||||
func (_m *MockCgroupNotifier) Start(eventCh chan<- struct{}) {
|
||||
_m.Called(eventCh)
|
||||
}
|
||||
|
||||
// MockCgroupNotifier_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type MockCgroupNotifier_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
// - eventCh chan<- struct{}
|
||||
func (_e *MockCgroupNotifier_Expecter) Start(eventCh interface{}) *MockCgroupNotifier_Start_Call {
|
||||
return &MockCgroupNotifier_Start_Call{Call: _e.mock.On("Start", eventCh)}
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Start_Call) Run(run func(eventCh chan<- struct{})) *MockCgroupNotifier_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(chan<- struct{}))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Start_Call) Return() *MockCgroupNotifier_Start_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Start_Call) RunAndReturn(run func(chan<- struct{})) *MockCgroupNotifier_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Stop provides a mock function with given fields:
|
||||
func (_m *MockCgroupNotifier) Stop() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// MockCgroupNotifier_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||
type MockCgroupNotifier_Stop_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Stop is a helper method to define mock.On call
|
||||
func (_e *MockCgroupNotifier_Expecter) Stop() *MockCgroupNotifier_Stop_Call {
|
||||
return &MockCgroupNotifier_Stop_Call{Call: _e.mock.On("Stop")}
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Stop_Call) Run(run func()) *MockCgroupNotifier_Stop_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Stop_Call) Return() *MockCgroupNotifier_Stop_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCgroupNotifier_Stop_Call) RunAndReturn(run func()) *MockCgroupNotifier_Stop_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockCgroupNotifier creates a new instance of MockCgroupNotifier. 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 NewMockCgroupNotifier(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockCgroupNotifier {
|
||||
mock := &MockCgroupNotifier{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
108
pkg/kubelet/eviction/mock_notifier_factory_test.go
Normal file
108
pkg/kubelet/eviction/mock_notifier_factory_test.go
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
package eviction
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
|
||||
// MockNotifierFactory is an autogenerated mock type for the NotifierFactory type
|
||||
type MockNotifierFactory struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockNotifierFactory_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockNotifierFactory) EXPECT() *MockNotifierFactory_Expecter {
|
||||
return &MockNotifierFactory_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// NewCgroupNotifier provides a mock function with given fields: path, attribute, threshold
|
||||
func (_m *MockNotifierFactory) NewCgroupNotifier(path string, attribute string, threshold int64) (CgroupNotifier, error) {
|
||||
ret := _m.Called(path, attribute, threshold)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for NewCgroupNotifier")
|
||||
}
|
||||
|
||||
var r0 CgroupNotifier
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string, string, int64) (CgroupNotifier, error)); ok {
|
||||
return rf(path, attribute, threshold)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string, int64) CgroupNotifier); ok {
|
||||
r0 = rf(path, attribute, threshold)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(CgroupNotifier)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
|
||||
r1 = rf(path, attribute, threshold)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockNotifierFactory_NewCgroupNotifier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewCgroupNotifier'
|
||||
type MockNotifierFactory_NewCgroupNotifier_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// NewCgroupNotifier is a helper method to define mock.On call
|
||||
// - path string
|
||||
// - attribute string
|
||||
// - threshold int64
|
||||
func (_e *MockNotifierFactory_Expecter) NewCgroupNotifier(path interface{}, attribute interface{}, threshold interface{}) *MockNotifierFactory_NewCgroupNotifier_Call {
|
||||
return &MockNotifierFactory_NewCgroupNotifier_Call{Call: _e.mock.On("NewCgroupNotifier", path, attribute, threshold)}
|
||||
}
|
||||
|
||||
func (_c *MockNotifierFactory_NewCgroupNotifier_Call) Run(run func(path string, attribute string, threshold int64)) *MockNotifierFactory_NewCgroupNotifier_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string), args[2].(int64))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockNotifierFactory_NewCgroupNotifier_Call) Return(_a0 CgroupNotifier, _a1 error) *MockNotifierFactory_NewCgroupNotifier_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockNotifierFactory_NewCgroupNotifier_Call) RunAndReturn(run func(string, string, int64) (CgroupNotifier, error)) *MockNotifierFactory_NewCgroupNotifier_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockNotifierFactory creates a new instance of MockNotifierFactory. 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 NewMockNotifierFactory(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockNotifierFactory {
|
||||
mock := &MockNotifierFactory{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
@@ -14,373 +14,161 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: types.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=types.go -destination=mock_threshold_notifier_test.go -package=eviction NotifierFactory,ThresholdNotifier
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package eviction is a generated GoMock package.
|
||||
package eviction
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
v1alpha1 "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
|
||||
)
|
||||
|
||||
// MockManager is a mock of Manager interface.
|
||||
type MockManager struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManagerMockRecorder
|
||||
}
|
||||
|
||||
// MockManagerMockRecorder is the mock recorder for MockManager.
|
||||
type MockManagerMockRecorder struct {
|
||||
mock *MockManager
|
||||
}
|
||||
|
||||
// NewMockManager creates a new mock instance.
|
||||
func NewMockManager(ctrl *gomock.Controller) *MockManager {
|
||||
mock := &MockManager{ctrl: ctrl}
|
||||
mock.recorder = &MockManagerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager) EXPECT() *MockManagerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// IsUnderDiskPressure mocks base method.
|
||||
func (m *MockManager) IsUnderDiskPressure() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsUnderDiskPressure")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsUnderDiskPressure indicates an expected call of IsUnderDiskPressure.
|
||||
func (mr *MockManagerMockRecorder) IsUnderDiskPressure() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsUnderDiskPressure", reflect.TypeOf((*MockManager)(nil).IsUnderDiskPressure))
|
||||
}
|
||||
|
||||
// IsUnderMemoryPressure mocks base method.
|
||||
func (m *MockManager) IsUnderMemoryPressure() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsUnderMemoryPressure")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsUnderMemoryPressure indicates an expected call of IsUnderMemoryPressure.
|
||||
func (mr *MockManagerMockRecorder) IsUnderMemoryPressure() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsUnderMemoryPressure", reflect.TypeOf((*MockManager)(nil).IsUnderMemoryPressure))
|
||||
}
|
||||
|
||||
// IsUnderPIDPressure mocks base method.
|
||||
func (m *MockManager) IsUnderPIDPressure() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsUnderPIDPressure")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsUnderPIDPressure indicates an expected call of IsUnderPIDPressure.
|
||||
func (mr *MockManagerMockRecorder) IsUnderPIDPressure() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsUnderPIDPressure", reflect.TypeOf((*MockManager)(nil).IsUnderPIDPressure))
|
||||
}
|
||||
|
||||
// Start mocks base method.
|
||||
func (m *MockManager) Start(diskInfoProvider DiskInfoProvider, podFunc ActivePodsFunc, podCleanedUpFunc PodCleanedUpFunc, monitoringInterval time.Duration) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Start", diskInfoProvider, podFunc, podCleanedUpFunc, monitoringInterval)
|
||||
}
|
||||
|
||||
// Start indicates an expected call of Start.
|
||||
func (mr *MockManagerMockRecorder) Start(diskInfoProvider, podFunc, podCleanedUpFunc, monitoringInterval any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockManager)(nil).Start), diskInfoProvider, podFunc, podCleanedUpFunc, monitoringInterval)
|
||||
}
|
||||
|
||||
// MockDiskInfoProvider is a mock of DiskInfoProvider interface.
|
||||
type MockDiskInfoProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDiskInfoProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockDiskInfoProviderMockRecorder is the mock recorder for MockDiskInfoProvider.
|
||||
type MockDiskInfoProviderMockRecorder struct {
|
||||
mock *MockDiskInfoProvider
|
||||
}
|
||||
|
||||
// NewMockDiskInfoProvider creates a new mock instance.
|
||||
func NewMockDiskInfoProvider(ctrl *gomock.Controller) *MockDiskInfoProvider {
|
||||
mock := &MockDiskInfoProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockDiskInfoProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDiskInfoProvider) EXPECT() *MockDiskInfoProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// HasDedicatedImageFs mocks base method.
|
||||
func (m *MockDiskInfoProvider) HasDedicatedImageFs(ctx context.Context) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "HasDedicatedImageFs", ctx)
|
||||
ret0, _ := ret[0].(bool)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// HasDedicatedImageFs indicates an expected call of HasDedicatedImageFs.
|
||||
func (mr *MockDiskInfoProviderMockRecorder) HasDedicatedImageFs(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasDedicatedImageFs", reflect.TypeOf((*MockDiskInfoProvider)(nil).HasDedicatedImageFs), ctx)
|
||||
}
|
||||
|
||||
// MockImageGC is a mock of ImageGC interface.
|
||||
type MockImageGC struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockImageGCMockRecorder
|
||||
}
|
||||
|
||||
// MockImageGCMockRecorder is the mock recorder for MockImageGC.
|
||||
type MockImageGCMockRecorder struct {
|
||||
mock *MockImageGC
|
||||
}
|
||||
|
||||
// NewMockImageGC creates a new mock instance.
|
||||
func NewMockImageGC(ctrl *gomock.Controller) *MockImageGC {
|
||||
mock := &MockImageGC{ctrl: ctrl}
|
||||
mock.recorder = &MockImageGCMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockImageGC) EXPECT() *MockImageGCMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// DeleteUnusedImages mocks base method.
|
||||
func (m *MockImageGC) DeleteUnusedImages(ctx context.Context) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DeleteUnusedImages", ctx)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DeleteUnusedImages indicates an expected call of DeleteUnusedImages.
|
||||
func (mr *MockImageGCMockRecorder) DeleteUnusedImages(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUnusedImages", reflect.TypeOf((*MockImageGC)(nil).DeleteUnusedImages), ctx)
|
||||
}
|
||||
|
||||
// MockContainerGC is a mock of ContainerGC interface.
|
||||
type MockContainerGC struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockContainerGCMockRecorder
|
||||
}
|
||||
|
||||
// MockContainerGCMockRecorder is the mock recorder for MockContainerGC.
|
||||
type MockContainerGCMockRecorder struct {
|
||||
mock *MockContainerGC
|
||||
}
|
||||
|
||||
// NewMockContainerGC creates a new mock instance.
|
||||
func NewMockContainerGC(ctrl *gomock.Controller) *MockContainerGC {
|
||||
mock := &MockContainerGC{ctrl: ctrl}
|
||||
mock.recorder = &MockContainerGCMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockContainerGC) EXPECT() *MockContainerGCMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// DeleteAllUnusedContainers mocks base method.
|
||||
func (m *MockContainerGC) DeleteAllUnusedContainers(ctx context.Context) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DeleteAllUnusedContainers", ctx)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DeleteAllUnusedContainers indicates an expected call of DeleteAllUnusedContainers.
|
||||
func (mr *MockContainerGCMockRecorder) DeleteAllUnusedContainers(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAllUnusedContainers", reflect.TypeOf((*MockContainerGC)(nil).DeleteAllUnusedContainers), ctx)
|
||||
}
|
||||
|
||||
// IsContainerFsSeparateFromImageFs mocks base method.
|
||||
func (m *MockContainerGC) IsContainerFsSeparateFromImageFs(ctx context.Context) bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "IsContainerFsSeparateFromImageFs", ctx)
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// IsContainerFsSeparateFromImageFs indicates an expected call of IsContainerFsSeparateFromImageFs.
|
||||
func (mr *MockContainerGCMockRecorder) IsContainerFsSeparateFromImageFs(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsContainerFsSeparateFromImageFs", reflect.TypeOf((*MockContainerGC)(nil).IsContainerFsSeparateFromImageFs), ctx)
|
||||
}
|
||||
|
||||
// MockCgroupNotifier is a mock of CgroupNotifier interface.
|
||||
type MockCgroupNotifier struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockCgroupNotifierMockRecorder
|
||||
}
|
||||
|
||||
// MockCgroupNotifierMockRecorder is the mock recorder for MockCgroupNotifier.
|
||||
type MockCgroupNotifierMockRecorder struct {
|
||||
mock *MockCgroupNotifier
|
||||
}
|
||||
|
||||
// NewMockCgroupNotifier creates a new mock instance.
|
||||
func NewMockCgroupNotifier(ctrl *gomock.Controller) *MockCgroupNotifier {
|
||||
mock := &MockCgroupNotifier{ctrl: ctrl}
|
||||
mock.recorder = &MockCgroupNotifierMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockCgroupNotifier) EXPECT() *MockCgroupNotifierMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Start mocks base method.
|
||||
func (m *MockCgroupNotifier) Start(eventCh chan<- struct{}) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Start", eventCh)
|
||||
}
|
||||
|
||||
// Start indicates an expected call of Start.
|
||||
func (mr *MockCgroupNotifierMockRecorder) Start(eventCh any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockCgroupNotifier)(nil).Start), eventCh)
|
||||
}
|
||||
|
||||
// Stop mocks base method.
|
||||
func (m *MockCgroupNotifier) Stop() {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Stop")
|
||||
}
|
||||
|
||||
// Stop indicates an expected call of Stop.
|
||||
func (mr *MockCgroupNotifierMockRecorder) Stop() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*MockCgroupNotifier)(nil).Stop))
|
||||
}
|
||||
|
||||
// MockNotifierFactory is a mock of NotifierFactory interface.
|
||||
type MockNotifierFactory struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockNotifierFactoryMockRecorder
|
||||
}
|
||||
|
||||
// MockNotifierFactoryMockRecorder is the mock recorder for MockNotifierFactory.
|
||||
type MockNotifierFactoryMockRecorder struct {
|
||||
mock *MockNotifierFactory
|
||||
}
|
||||
|
||||
// NewMockNotifierFactory creates a new mock instance.
|
||||
func NewMockNotifierFactory(ctrl *gomock.Controller) *MockNotifierFactory {
|
||||
mock := &MockNotifierFactory{ctrl: ctrl}
|
||||
mock.recorder = &MockNotifierFactoryMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockNotifierFactory) EXPECT() *MockNotifierFactoryMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// NewCgroupNotifier mocks base method.
|
||||
func (m *MockNotifierFactory) NewCgroupNotifier(path, attribute string, threshold int64) (CgroupNotifier, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewCgroupNotifier", path, attribute, threshold)
|
||||
ret0, _ := ret[0].(CgroupNotifier)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// NewCgroupNotifier indicates an expected call of NewCgroupNotifier.
|
||||
func (mr *MockNotifierFactoryMockRecorder) NewCgroupNotifier(path, attribute, threshold any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewCgroupNotifier", reflect.TypeOf((*MockNotifierFactory)(nil).NewCgroupNotifier), path, attribute, threshold)
|
||||
}
|
||||
|
||||
// MockThresholdNotifier is a mock of ThresholdNotifier interface.
|
||||
// MockThresholdNotifier is an autogenerated mock type for the ThresholdNotifier type
|
||||
type MockThresholdNotifier struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockThresholdNotifierMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockThresholdNotifierMockRecorder is the mock recorder for MockThresholdNotifier.
|
||||
type MockThresholdNotifierMockRecorder struct {
|
||||
mock *MockThresholdNotifier
|
||||
type MockThresholdNotifier_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockThresholdNotifier creates a new mock instance.
|
||||
func NewMockThresholdNotifier(ctrl *gomock.Controller) *MockThresholdNotifier {
|
||||
mock := &MockThresholdNotifier{ctrl: ctrl}
|
||||
mock.recorder = &MockThresholdNotifierMockRecorder{mock}
|
||||
func (_m *MockThresholdNotifier) EXPECT() *MockThresholdNotifier_Expecter {
|
||||
return &MockThresholdNotifier_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Description provides a mock function with given fields:
|
||||
func (_m *MockThresholdNotifier) Description() string {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Description")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockThresholdNotifier_Description_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Description'
|
||||
type MockThresholdNotifier_Description_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Description is a helper method to define mock.On call
|
||||
func (_e *MockThresholdNotifier_Expecter) Description() *MockThresholdNotifier_Description_Call {
|
||||
return &MockThresholdNotifier_Description_Call{Call: _e.mock.On("Description")}
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Description_Call) Run(run func()) *MockThresholdNotifier_Description_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Description_Call) Return(_a0 string) *MockThresholdNotifier_Description_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Description_Call) RunAndReturn(run func() string) *MockThresholdNotifier_Description_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields:
|
||||
func (_m *MockThresholdNotifier) Start() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// MockThresholdNotifier_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type MockThresholdNotifier_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
func (_e *MockThresholdNotifier_Expecter) Start() *MockThresholdNotifier_Start_Call {
|
||||
return &MockThresholdNotifier_Start_Call{Call: _e.mock.On("Start")}
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Start_Call) Run(run func()) *MockThresholdNotifier_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Start_Call) Return() *MockThresholdNotifier_Start_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_Start_Call) RunAndReturn(run func()) *MockThresholdNotifier_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UpdateThreshold provides a mock function with given fields: summary
|
||||
func (_m *MockThresholdNotifier) UpdateThreshold(summary *v1alpha1.Summary) error {
|
||||
ret := _m.Called(summary)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateThreshold")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*v1alpha1.Summary) error); ok {
|
||||
r0 = rf(summary)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockThresholdNotifier_UpdateThreshold_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateThreshold'
|
||||
type MockThresholdNotifier_UpdateThreshold_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UpdateThreshold is a helper method to define mock.On call
|
||||
// - summary *v1alpha1.Summary
|
||||
func (_e *MockThresholdNotifier_Expecter) UpdateThreshold(summary interface{}) *MockThresholdNotifier_UpdateThreshold_Call {
|
||||
return &MockThresholdNotifier_UpdateThreshold_Call{Call: _e.mock.On("UpdateThreshold", summary)}
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_UpdateThreshold_Call) Run(run func(summary *v1alpha1.Summary)) *MockThresholdNotifier_UpdateThreshold_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1alpha1.Summary))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_UpdateThreshold_Call) Return(_a0 error) *MockThresholdNotifier_UpdateThreshold_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockThresholdNotifier_UpdateThreshold_Call) RunAndReturn(run func(*v1alpha1.Summary) error) *MockThresholdNotifier_UpdateThreshold_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockThresholdNotifier creates a new instance of MockThresholdNotifier. 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 NewMockThresholdNotifier(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockThresholdNotifier {
|
||||
mock := &MockThresholdNotifier{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockThresholdNotifier) EXPECT() *MockThresholdNotifierMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Description mocks base method.
|
||||
func (m *MockThresholdNotifier) Description() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Description")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Description indicates an expected call of Description.
|
||||
func (mr *MockThresholdNotifierMockRecorder) Description() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Description", reflect.TypeOf((*MockThresholdNotifier)(nil).Description))
|
||||
}
|
||||
|
||||
// Start mocks base method.
|
||||
func (m *MockThresholdNotifier) Start() {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Start")
|
||||
}
|
||||
|
||||
// Start indicates an expected call of Start.
|
||||
func (mr *MockThresholdNotifierMockRecorder) Start() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockThresholdNotifier)(nil).Start))
|
||||
}
|
||||
|
||||
// UpdateThreshold mocks base method.
|
||||
func (m *MockThresholdNotifier) UpdateThreshold(summary *v1alpha1.Summary) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "UpdateThreshold", summary)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// UpdateThreshold indicates an expected call of UpdateThreshold.
|
||||
func (mr *MockThresholdNotifierMockRecorder) UpdateThreshold(summary any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateThreshold", reflect.TypeOf((*MockThresholdNotifier)(nil).UpdateThreshold), summary)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=types.go -destination=mock_threshold_notifier_test.go -package=eviction NotifierFactory,ThresholdNotifier
|
||||
//go:generate mockery
|
||||
package eviction
|
||||
|
||||
import (
|
||||
|
||||
@@ -24,8 +24,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
noopoteltrace "go.opentelemetry.io/otel/trace/noop"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
@@ -125,9 +125,7 @@ func makeContainer(id int) *container.Container {
|
||||
|
||||
func TestDetectImagesInitialDetect(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -175,9 +173,7 @@ func TestDetectImagesInitialDetectWithRuntimeHandlerInImageCriAPIFeatureGate(t *
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.RuntimeClassInImageCriAPI, true)
|
||||
testRuntimeHandler := "test-runtimeHandler"
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -231,9 +227,7 @@ func TestDetectImagesInitialDetectWithRuntimeHandlerInImageCriAPIFeatureGate(t *
|
||||
|
||||
func TestDetectImagesWithNewImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
// Just one image initially.
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
@@ -285,9 +279,7 @@ func TestDetectImagesWithNewImage(t *testing.T) {
|
||||
|
||||
func TestDeleteUnusedImagesExemptSandboxImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -306,8 +298,7 @@ func TestDeleteUnusedImagesExemptSandboxImage(t *testing.T) {
|
||||
|
||||
func TestDeletePinnedImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -330,8 +321,7 @@ func TestDeletePinnedImage(t *testing.T) {
|
||||
|
||||
func TestDoNotDeletePinnedImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -352,8 +342,7 @@ func TestDoNotDeletePinnedImage(t *testing.T) {
|
||||
|
||||
func TestDeleteUnPinnedImage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -374,8 +363,7 @@ func TestDeleteUnPinnedImage(t *testing.T) {
|
||||
|
||||
func TestAllPinnedImages(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -397,9 +385,7 @@ func TestAllPinnedImages(t *testing.T) {
|
||||
|
||||
func TestDetectImagesContainerStopped(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -438,9 +424,7 @@ func TestDetectImagesContainerStopped(t *testing.T) {
|
||||
|
||||
func TestDetectImagesWithRemovedImages(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -469,9 +453,7 @@ func TestDetectImagesWithRemovedImages(t *testing.T) {
|
||||
|
||||
func TestFreeSpaceImagesInUseContainersAreIgnored(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -492,9 +474,7 @@ func TestFreeSpaceImagesInUseContainersAreIgnored(t *testing.T) {
|
||||
|
||||
func TestDeleteUnusedImagesRemoveAllUnusedImages(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -518,9 +498,7 @@ func TestDeleteUnusedImagesRemoveAllUnusedImages(t *testing.T) {
|
||||
|
||||
func TestDeleteUnusedImagesLimitByImageLiveTime(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{
|
||||
MinAge: time.Second * 3, // set minAge to 3 seconds,
|
||||
@@ -553,9 +531,7 @@ func TestDeleteUnusedImagesLimitByImageLiveTime(t *testing.T) {
|
||||
|
||||
func TestFreeSpaceRemoveByLeastRecentlyUsed(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -607,9 +583,7 @@ func TestFreeSpaceRemoveByLeastRecentlyUsed(t *testing.T) {
|
||||
|
||||
func TestFreeSpaceTiesBrokenByDetectedTime(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
manager, fakeRuntime := newRealImageGCManager(ImageGCPolicy{}, mockStatsProvider)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
@@ -647,9 +621,7 @@ func TestGarbageCollectBelowLowThreshold(t *testing.T) {
|
||||
HighThresholdPercent: 90,
|
||||
LowThresholdPercent: 80,
|
||||
}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager, _ := newRealImageGCManager(policy, mockStatsProvider)
|
||||
|
||||
// Expect 40% usage.
|
||||
@@ -657,7 +629,7 @@ func TestGarbageCollectBelowLowThreshold(t *testing.T) {
|
||||
AvailableBytes: uint64Ptr(600),
|
||||
CapacityBytes: uint64Ptr(1000),
|
||||
}
|
||||
mockStatsProvider.EXPECT().ImageFsStats(gomock.Any()).Return(imageStats, imageStats, nil)
|
||||
mockStatsProvider.EXPECT().ImageFsStats(mock.Anything).Return(imageStats, imageStats, nil)
|
||||
|
||||
assert.NoError(t, manager.GarbageCollect(ctx, time.Now()))
|
||||
}
|
||||
@@ -668,12 +640,10 @@ func TestGarbageCollectCadvisorFailure(t *testing.T) {
|
||||
HighThresholdPercent: 90,
|
||||
LowThresholdPercent: 80,
|
||||
}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager, _ := newRealImageGCManager(policy, mockStatsProvider)
|
||||
|
||||
mockStatsProvider.EXPECT().ImageFsStats(gomock.Any()).Return(&statsapi.FsStats{}, &statsapi.FsStats{}, fmt.Errorf("error"))
|
||||
mockStatsProvider.EXPECT().ImageFsStats(mock.Anything).Return(&statsapi.FsStats{}, &statsapi.FsStats{}, fmt.Errorf("error"))
|
||||
assert.NotNil(t, manager.GarbageCollect(ctx, time.Now()))
|
||||
}
|
||||
|
||||
@@ -684,9 +654,7 @@ func TestGarbageCollectBelowSuccess(t *testing.T) {
|
||||
LowThresholdPercent: 80,
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager, fakeRuntime := newRealImageGCManager(policy, mockStatsProvider)
|
||||
|
||||
// Expect 95% usage and most of it gets freed.
|
||||
@@ -694,7 +662,7 @@ func TestGarbageCollectBelowSuccess(t *testing.T) {
|
||||
AvailableBytes: uint64Ptr(50),
|
||||
CapacityBytes: uint64Ptr(1000),
|
||||
}
|
||||
mockStatsProvider.EXPECT().ImageFsStats(gomock.Any()).Return(imageFs, imageFs, nil)
|
||||
mockStatsProvider.EXPECT().ImageFsStats(mock.Anything).Return(imageFs, imageFs, nil)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
makeImage(0, 450),
|
||||
}
|
||||
@@ -708,9 +676,7 @@ func TestGarbageCollectNotEnoughFreed(t *testing.T) {
|
||||
HighThresholdPercent: 90,
|
||||
LowThresholdPercent: 80,
|
||||
}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager, fakeRuntime := newRealImageGCManager(policy, mockStatsProvider)
|
||||
|
||||
// Expect 95% usage and little of it gets freed.
|
||||
@@ -718,7 +684,7 @@ func TestGarbageCollectNotEnoughFreed(t *testing.T) {
|
||||
AvailableBytes: uint64Ptr(50),
|
||||
CapacityBytes: uint64Ptr(1000),
|
||||
}
|
||||
mockStatsProvider.EXPECT().ImageFsStats(gomock.Any()).Return(imageFs, imageFs, nil)
|
||||
mockStatsProvider.EXPECT().ImageFsStats(mock.Anything).Return(imageFs, imageFs, nil)
|
||||
fakeRuntime.ImageList = []container.Image{
|
||||
makeImage(0, 50),
|
||||
}
|
||||
@@ -734,9 +700,7 @@ func TestGarbageCollectImageNotOldEnough(t *testing.T) {
|
||||
MinAge: time.Minute * 1,
|
||||
}
|
||||
fakeRuntime := &containertest.FakeRuntime{}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager := &realImageGCManager{
|
||||
runtime: fakeRuntime,
|
||||
policy: policy,
|
||||
@@ -790,9 +754,7 @@ func TestGarbageCollectImageTooOld(t *testing.T) {
|
||||
MaxAge: time.Minute * 1,
|
||||
}
|
||||
fakeRuntime := &containertest.FakeRuntime{}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager := &realImageGCManager{
|
||||
runtime: fakeRuntime,
|
||||
policy: policy,
|
||||
@@ -847,9 +809,7 @@ func TestGarbageCollectImageMaxAgeDisabled(t *testing.T) {
|
||||
MaxAge: 0,
|
||||
}
|
||||
fakeRuntime := &containertest.FakeRuntime{}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
manager := &realImageGCManager{
|
||||
runtime: fakeRuntime,
|
||||
policy: policy,
|
||||
|
||||
@@ -40,7 +40,6 @@ import (
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
core "k8s.io/client-go/testing"
|
||||
"k8s.io/mount-utils"
|
||||
|
||||
@@ -3054,15 +3053,13 @@ func TestNewMainKubeletStandAlone(t *testing.T) {
|
||||
}
|
||||
var prober volume.DynamicPluginProber
|
||||
tp := noopoteltrace.NewTracerProvider()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
cadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
cadvisor.EXPECT().MachineInfo().Return(&cadvisorapi.MachineInfo{}, nil).AnyTimes()
|
||||
cadvisor := cadvisortest.NewMockInterface(t)
|
||||
cadvisor.EXPECT().MachineInfo().Return(&cadvisorapi.MachineInfo{}, nil).Maybe()
|
||||
cadvisor.EXPECT().ImagesFsInfo().Return(cadvisorapiv2.FsInfo{
|
||||
Usage: 400,
|
||||
Capacity: 1000,
|
||||
Available: 600,
|
||||
}, nil).AnyTimes()
|
||||
}, nil).Maybe()
|
||||
tlsOptions := &server.TLSOptions{
|
||||
Config: &tls.Config{
|
||||
MinVersion: 0,
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
@@ -440,13 +439,10 @@ func TestPodLogDirectoryGC(t *testing.T) {
|
||||
podStateProvider.removed["789"] = struct{}{}
|
||||
podStateProvider.removed["654"] = struct{}{}
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
fakeOS.ReadDirFn = func(string) ([]os.DirEntry, error) {
|
||||
var dirEntries []os.DirEntry
|
||||
for _, file := range files {
|
||||
mockDE := containertest.NewMockDirEntry(ctrl)
|
||||
mockDE := containertest.NewMockDirEntry(t)
|
||||
mockDE.EXPECT().Name().Return(file)
|
||||
dirEntries = append(dirEntries, mockDE)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"go.uber.org/mock/gomock"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/component-base/metrics/testutil"
|
||||
statsapi "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
|
||||
@@ -48,8 +47,6 @@ func TestCollectResourceMetrics(t *testing.T) {
|
||||
"pod_memory_working_set_bytes",
|
||||
"pod_swap_usage_bytes",
|
||||
}
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -408,8 +405,8 @@ func TestCollectResourceMetrics(t *testing.T) {
|
||||
tc := test
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
provider := summaryprovidertest.NewMockSummaryProvider(mockCtrl)
|
||||
provider.EXPECT().GetCPUAndMemoryStats(ctx).Return(tc.summary, tc.summaryErr).AnyTimes()
|
||||
provider := summaryprovidertest.NewMockSummaryProvider(t)
|
||||
provider.EXPECT().GetCPUAndMemoryStats(ctx).Return(tc.summary, tc.summaryErr).Maybe()
|
||||
collector := NewResourceMetricsCollector(provider)
|
||||
|
||||
if err := testutil.CustomCollectAndCompare(collector, strings.NewReader(tc.expectedMetrics), interestedMetrics...); err != nil {
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"go.uber.org/mock/gomock"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/component-base/metrics/testutil"
|
||||
statsapi "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
|
||||
@@ -142,12 +141,10 @@ func TestVolumeStatsCollector(t *testing.T) {
|
||||
}
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).Maybe()
|
||||
if err := testutil.CustomCollectAndCompare(&volumeStatsCollector{statsProvider: mockStatsProvider}, strings.NewReader(want), metrics...); err != nil {
|
||||
t.Errorf("unexpected collecting result:\n%s", err)
|
||||
}
|
||||
@@ -230,12 +227,10 @@ func TestVolumeStatsCollectorWithNullVolumeStatus(t *testing.T) {
|
||||
}
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).Maybe()
|
||||
if err := testutil.CustomCollectAndCompare(&volumeStatsCollector{statsProvider: mockStatsProvider}, strings.NewReader(want), metrics...); err != nil {
|
||||
t.Errorf("unexpected collecting result:\n%s", err)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/component-base/metrics/testutil"
|
||||
@@ -352,15 +351,13 @@ func createTestPodsStatusesAndEvents(num int) ([]*kubecontainer.Pod, []*kubecont
|
||||
|
||||
func TestRelistWithCache(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
runtimeMock := containertest.NewMockRuntime(mockCtrl)
|
||||
runtimeMock := containertest.NewMockRuntime(t)
|
||||
|
||||
pleg := newTestGenericPLEGWithRuntimeMock(runtimeMock)
|
||||
ch := pleg.Watch()
|
||||
|
||||
pods, statuses, events := createTestPodsStatusesAndEvents(2)
|
||||
runtimeMock.EXPECT().GetPods(ctx, true).Return(pods, nil).AnyTimes()
|
||||
runtimeMock.EXPECT().GetPods(ctx, true).Return(pods, nil).Maybe()
|
||||
runtimeMock.EXPECT().GetPodStatus(ctx, pods[0].ID, "", "").Return(statuses[0], nil).Times(1)
|
||||
// Inject an error when querying runtime for the pod status for pods[1].
|
||||
statusErr := fmt.Errorf("unable to get status")
|
||||
@@ -409,9 +406,7 @@ func TestRelistWithCache(t *testing.T) {
|
||||
|
||||
func TestRemoveCacheEntry(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
runtimeMock := containertest.NewMockRuntime(mockCtrl)
|
||||
runtimeMock := containertest.NewMockRuntime(t)
|
||||
pleg := newTestGenericPLEGWithRuntimeMock(runtimeMock)
|
||||
|
||||
pods, statuses, _ := createTestPodsStatusesAndEvents(1)
|
||||
@@ -457,9 +452,7 @@ func TestHealthy(t *testing.T) {
|
||||
|
||||
func TestRelistWithReinspection(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
runtimeMock := containertest.NewMockRuntime(mockCtrl)
|
||||
runtimeMock := containertest.NewMockRuntime(t)
|
||||
|
||||
pleg := newTestGenericPLEGWithRuntimeMock(runtimeMock)
|
||||
ch := pleg.Watch()
|
||||
@@ -613,11 +606,8 @@ func TestRelistIPChange(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
for _, tc := range testCases {
|
||||
runtimeMock := containertest.NewMockRuntime(mockCtrl)
|
||||
runtimeMock := containertest.NewMockRuntime(t)
|
||||
|
||||
pleg := newTestGenericPLEGWithRuntimeMock(runtimeMock)
|
||||
ch := pleg.Watch()
|
||||
|
||||
10
pkg/kubelet/pod/.mockery.yaml
Normal file
10
pkg/kubelet/pod/.mockery.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: "mock_{{.InterfaceName | snakecase}}.go"
|
||||
boilerplate-file: ../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/pod:
|
||||
interfaces:
|
||||
Manager:
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=pod_manager.go -destination=testing/mock_manager.go -package=testing Manager
|
||||
//go:generate mockery
|
||||
package pod
|
||||
|
||||
import (
|
||||
|
||||
@@ -14,243 +14,752 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: pod_manager.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=pod_manager.go -destination=testing/mock_manager.go -package=testing Manager
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
kubelettypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
types0 "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// MockManager is a mock of Manager interface.
|
||||
// MockManager is an autogenerated mock type for the Manager type
|
||||
type MockManager struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManagerMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockManagerMockRecorder is the mock recorder for MockManager.
|
||||
type MockManagerMockRecorder struct {
|
||||
mock *MockManager
|
||||
type MockManager_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockManager creates a new mock instance.
|
||||
func NewMockManager(ctrl *gomock.Controller) *MockManager {
|
||||
mock := &MockManager{ctrl: ctrl}
|
||||
mock.recorder = &MockManagerMockRecorder{mock}
|
||||
func (_m *MockManager) EXPECT() *MockManager_Expecter {
|
||||
return &MockManager_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// AddPod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) AddPod(_a0 *v1.Pod) {
|
||||
_m.Called(_a0)
|
||||
}
|
||||
|
||||
// MockManager_AddPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPod'
|
||||
type MockManager_AddPod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// AddPod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) AddPod(_a0 interface{}) *MockManager_AddPod_Call {
|
||||
return &MockManager_AddPod_Call{Call: _e.mock.On("AddPod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_AddPod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_AddPod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_AddPod_Call) Return() *MockManager_AddPod_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_AddPod_Call) RunAndReturn(run func(*v1.Pod)) *MockManager_AddPod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) GetMirrorPodByPod(_a0 *v1.Pod) (*v1.Pod, bool) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetMirrorPodByPod")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) (*v1.Pod, bool)); ok {
|
||||
return rf(_a0)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) *v1.Pod); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*v1.Pod) bool); ok {
|
||||
r1 = rf(_a0)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetMirrorPodByPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMirrorPodByPod'
|
||||
type MockManager_GetMirrorPodByPod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) GetMirrorPodByPod(_a0 interface{}) *MockManager_GetMirrorPodByPod_Call {
|
||||
return &MockManager_GetMirrorPodByPod_Call{Call: _e.mock.On("GetMirrorPodByPod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetMirrorPodByPod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_GetMirrorPodByPod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetMirrorPodByPod_Call) Return(_a0 *v1.Pod, _a1 bool) *MockManager_GetMirrorPodByPod_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetMirrorPodByPod_Call) RunAndReturn(run func(*v1.Pod) (*v1.Pod, bool)) *MockManager_GetMirrorPodByPod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodAndMirrorPod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) GetPodAndMirrorPod(_a0 *v1.Pod) (*v1.Pod, *v1.Pod, bool) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodAndMirrorPod")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 *v1.Pod
|
||||
var r2 bool
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) (*v1.Pod, *v1.Pod, bool)); ok {
|
||||
return rf(_a0)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) *v1.Pod); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*v1.Pod) *v1.Pod); ok {
|
||||
r1 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(2).(func(*v1.Pod) bool); ok {
|
||||
r2 = rf(_a0)
|
||||
} else {
|
||||
r2 = ret.Get(2).(bool)
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// MockManager_GetPodAndMirrorPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodAndMirrorPod'
|
||||
type MockManager_GetPodAndMirrorPod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodAndMirrorPod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) GetPodAndMirrorPod(_a0 interface{}) *MockManager_GetPodAndMirrorPod_Call {
|
||||
return &MockManager_GetPodAndMirrorPod_Call{Call: _e.mock.On("GetPodAndMirrorPod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodAndMirrorPod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_GetPodAndMirrorPod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodAndMirrorPod_Call) Return(_a0 *v1.Pod, mirrorPod *v1.Pod, wasMirror bool) *MockManager_GetPodAndMirrorPod_Call {
|
||||
_c.Call.Return(_a0, mirrorPod, wasMirror)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodAndMirrorPod_Call) RunAndReturn(run func(*v1.Pod) (*v1.Pod, *v1.Pod, bool)) *MockManager_GetPodAndMirrorPod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodByFullName provides a mock function with given fields: podFullName
|
||||
func (_m *MockManager) GetPodByFullName(podFullName string) (*v1.Pod, bool) {
|
||||
ret := _m.Called(podFullName)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodByFullName")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(string) (*v1.Pod, bool)); ok {
|
||||
return rf(podFullName)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) *v1.Pod); ok {
|
||||
r0 = rf(podFullName)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) bool); ok {
|
||||
r1 = rf(podFullName)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetPodByFullName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByFullName'
|
||||
type MockManager_GetPodByFullName_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodByFullName is a helper method to define mock.On call
|
||||
// - podFullName string
|
||||
func (_e *MockManager_Expecter) GetPodByFullName(podFullName interface{}) *MockManager_GetPodByFullName_Call {
|
||||
return &MockManager_GetPodByFullName_Call{Call: _e.mock.On("GetPodByFullName", podFullName)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByFullName_Call) Run(run func(podFullName string)) *MockManager_GetPodByFullName_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByFullName_Call) Return(_a0 *v1.Pod, _a1 bool) *MockManager_GetPodByFullName_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByFullName_Call) RunAndReturn(run func(string) (*v1.Pod, bool)) *MockManager_GetPodByFullName_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodByMirrorPod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) GetPodByMirrorPod(_a0 *v1.Pod) (*v1.Pod, bool) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodByMirrorPod")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) (*v1.Pod, bool)); ok {
|
||||
return rf(_a0)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*v1.Pod) *v1.Pod); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*v1.Pod) bool); ok {
|
||||
r1 = rf(_a0)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetPodByMirrorPod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByMirrorPod'
|
||||
type MockManager_GetPodByMirrorPod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodByMirrorPod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) GetPodByMirrorPod(_a0 interface{}) *MockManager_GetPodByMirrorPod_Call {
|
||||
return &MockManager_GetPodByMirrorPod_Call{Call: _e.mock.On("GetPodByMirrorPod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByMirrorPod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_GetPodByMirrorPod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByMirrorPod_Call) Return(_a0 *v1.Pod, _a1 bool) *MockManager_GetPodByMirrorPod_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByMirrorPod_Call) RunAndReturn(run func(*v1.Pod) (*v1.Pod, bool)) *MockManager_GetPodByMirrorPod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodByName provides a mock function with given fields: namespace, name
|
||||
func (_m *MockManager) GetPodByName(namespace string, name string) (*v1.Pod, bool) {
|
||||
ret := _m.Called(namespace, name)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodByName")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(string, string) (*v1.Pod, bool)); ok {
|
||||
return rf(namespace, name)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) *v1.Pod); ok {
|
||||
r0 = rf(namespace, name)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) bool); ok {
|
||||
r1 = rf(namespace, name)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetPodByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByName'
|
||||
type MockManager_GetPodByName_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodByName is a helper method to define mock.On call
|
||||
// - namespace string
|
||||
// - name string
|
||||
func (_e *MockManager_Expecter) GetPodByName(namespace interface{}, name interface{}) *MockManager_GetPodByName_Call {
|
||||
return &MockManager_GetPodByName_Call{Call: _e.mock.On("GetPodByName", namespace, name)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByName_Call) Run(run func(namespace string, name string)) *MockManager_GetPodByName_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByName_Call) Return(_a0 *v1.Pod, _a1 bool) *MockManager_GetPodByName_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByName_Call) RunAndReturn(run func(string, string) (*v1.Pod, bool)) *MockManager_GetPodByName_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodByUID provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) GetPodByUID(_a0 types.UID) (*v1.Pod, bool) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodByUID")
|
||||
}
|
||||
|
||||
var r0 *v1.Pod
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(types.UID) (*v1.Pod, bool)); ok {
|
||||
return rf(_a0)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(types.UID) *v1.Pod); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(types.UID) bool); ok {
|
||||
r1 = rf(_a0)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetPodByUID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodByUID'
|
||||
type MockManager_GetPodByUID_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodByUID is a helper method to define mock.On call
|
||||
// - _a0 types.UID
|
||||
func (_e *MockManager_Expecter) GetPodByUID(_a0 interface{}) *MockManager_GetPodByUID_Call {
|
||||
return &MockManager_GetPodByUID_Call{Call: _e.mock.On("GetPodByUID", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByUID_Call) Run(run func(_a0 types.UID)) *MockManager_GetPodByUID_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(types.UID))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByUID_Call) Return(_a0 *v1.Pod, _a1 bool) *MockManager_GetPodByUID_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodByUID_Call) RunAndReturn(run func(types.UID) (*v1.Pod, bool)) *MockManager_GetPodByUID_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPods provides a mock function with given fields:
|
||||
func (_m *MockManager) GetPods() []*v1.Pod {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPods")
|
||||
}
|
||||
|
||||
var r0 []*v1.Pod
|
||||
if rf, ok := ret.Get(0).(func() []*v1.Pod); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockManager_GetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPods'
|
||||
type MockManager_GetPods_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPods is a helper method to define mock.On call
|
||||
func (_e *MockManager_Expecter) GetPods() *MockManager_GetPods_Call {
|
||||
return &MockManager_GetPods_Call{Call: _e.mock.On("GetPods")}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPods_Call) Run(run func()) *MockManager_GetPods_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPods_Call) Return(_a0 []*v1.Pod) *MockManager_GetPods_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPods_Call) RunAndReturn(run func() []*v1.Pod) *MockManager_GetPods_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetPodsAndMirrorPods provides a mock function with given fields:
|
||||
func (_m *MockManager) GetPodsAndMirrorPods() ([]*v1.Pod, []*v1.Pod, []string) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodsAndMirrorPods")
|
||||
}
|
||||
|
||||
var r0 []*v1.Pod
|
||||
var r1 []*v1.Pod
|
||||
var r2 []string
|
||||
if rf, ok := ret.Get(0).(func() ([]*v1.Pod, []*v1.Pod, []string)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() []*v1.Pod); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() []*v1.Pod); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).([]*v1.Pod)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(2).(func() []string); ok {
|
||||
r2 = rf()
|
||||
} else {
|
||||
if ret.Get(2) != nil {
|
||||
r2 = ret.Get(2).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// MockManager_GetPodsAndMirrorPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodsAndMirrorPods'
|
||||
type MockManager_GetPodsAndMirrorPods_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodsAndMirrorPods is a helper method to define mock.On call
|
||||
func (_e *MockManager_Expecter) GetPodsAndMirrorPods() *MockManager_GetPodsAndMirrorPods_Call {
|
||||
return &MockManager_GetPodsAndMirrorPods_Call{Call: _e.mock.On("GetPodsAndMirrorPods")}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodsAndMirrorPods_Call) Run(run func()) *MockManager_GetPodsAndMirrorPods_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodsAndMirrorPods_Call) Return(allPods []*v1.Pod, allMirrorPods []*v1.Pod, orphanedMirrorPodFullnames []string) *MockManager_GetPodsAndMirrorPods_Call {
|
||||
_c.Call.Return(allPods, allMirrorPods, orphanedMirrorPodFullnames)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetPodsAndMirrorPods_Call) RunAndReturn(run func() ([]*v1.Pod, []*v1.Pod, []string)) *MockManager_GetPodsAndMirrorPods_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetUIDTranslations provides a mock function with given fields:
|
||||
func (_m *MockManager) GetUIDTranslations() (map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID, map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetUIDTranslations")
|
||||
}
|
||||
|
||||
var r0 map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID
|
||||
var r1 map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID
|
||||
if rf, ok := ret.Get(0).(func() (map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID, map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockManager_GetUIDTranslations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUIDTranslations'
|
||||
type MockManager_GetUIDTranslations_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetUIDTranslations is a helper method to define mock.On call
|
||||
func (_e *MockManager_Expecter) GetUIDTranslations() *MockManager_GetUIDTranslations_Call {
|
||||
return &MockManager_GetUIDTranslations_Call{Call: _e.mock.On("GetUIDTranslations")}
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetUIDTranslations_Call) Run(run func()) *MockManager_GetUIDTranslations_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetUIDTranslations_Call) Return(podToMirror map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID, mirrorToPod map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID) *MockManager_GetUIDTranslations_Call {
|
||||
_c.Call.Return(podToMirror, mirrorToPod)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_GetUIDTranslations_Call) RunAndReturn(run func() (map[kubelettypes.ResolvedPodUID]kubelettypes.MirrorPodUID, map[kubelettypes.MirrorPodUID]kubelettypes.ResolvedPodUID)) *MockManager_GetUIDTranslations_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// RemovePod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) RemovePod(_a0 *v1.Pod) {
|
||||
_m.Called(_a0)
|
||||
}
|
||||
|
||||
// MockManager_RemovePod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemovePod'
|
||||
type MockManager_RemovePod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// RemovePod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) RemovePod(_a0 interface{}) *MockManager_RemovePod_Call {
|
||||
return &MockManager_RemovePod_Call{Call: _e.mock.On("RemovePod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_RemovePod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_RemovePod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_RemovePod_Call) Return() *MockManager_RemovePod_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_RemovePod_Call) RunAndReturn(run func(*v1.Pod)) *MockManager_RemovePod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetPods provides a mock function with given fields: pods
|
||||
func (_m *MockManager) SetPods(pods []*v1.Pod) {
|
||||
_m.Called(pods)
|
||||
}
|
||||
|
||||
// MockManager_SetPods_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetPods'
|
||||
type MockManager_SetPods_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SetPods is a helper method to define mock.On call
|
||||
// - pods []*v1.Pod
|
||||
func (_e *MockManager_Expecter) SetPods(pods interface{}) *MockManager_SetPods_Call {
|
||||
return &MockManager_SetPods_Call{Call: _e.mock.On("SetPods", pods)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_SetPods_Call) Run(run func(pods []*v1.Pod)) *MockManager_SetPods_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].([]*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_SetPods_Call) Return() *MockManager_SetPods_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_SetPods_Call) RunAndReturn(run func([]*v1.Pod)) *MockManager_SetPods_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// TranslatePodUID provides a mock function with given fields: uid
|
||||
func (_m *MockManager) TranslatePodUID(uid types.UID) kubelettypes.ResolvedPodUID {
|
||||
ret := _m.Called(uid)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for TranslatePodUID")
|
||||
}
|
||||
|
||||
var r0 kubelettypes.ResolvedPodUID
|
||||
if rf, ok := ret.Get(0).(func(types.UID) kubelettypes.ResolvedPodUID); ok {
|
||||
r0 = rf(uid)
|
||||
} else {
|
||||
r0 = ret.Get(0).(kubelettypes.ResolvedPodUID)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockManager_TranslatePodUID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TranslatePodUID'
|
||||
type MockManager_TranslatePodUID_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// TranslatePodUID is a helper method to define mock.On call
|
||||
// - uid types.UID
|
||||
func (_e *MockManager_Expecter) TranslatePodUID(uid interface{}) *MockManager_TranslatePodUID_Call {
|
||||
return &MockManager_TranslatePodUID_Call{Call: _e.mock.On("TranslatePodUID", uid)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_TranslatePodUID_Call) Run(run func(uid types.UID)) *MockManager_TranslatePodUID_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(types.UID))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_TranslatePodUID_Call) Return(_a0 kubelettypes.ResolvedPodUID) *MockManager_TranslatePodUID_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_TranslatePodUID_Call) RunAndReturn(run func(types.UID) kubelettypes.ResolvedPodUID) *MockManager_TranslatePodUID_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UpdatePod provides a mock function with given fields: _a0
|
||||
func (_m *MockManager) UpdatePod(_a0 *v1.Pod) {
|
||||
_m.Called(_a0)
|
||||
}
|
||||
|
||||
// MockManager_UpdatePod_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePod'
|
||||
type MockManager_UpdatePod_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UpdatePod is a helper method to define mock.On call
|
||||
// - _a0 *v1.Pod
|
||||
func (_e *MockManager_Expecter) UpdatePod(_a0 interface{}) *MockManager_UpdatePod_Call {
|
||||
return &MockManager_UpdatePod_Call{Call: _e.mock.On("UpdatePod", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockManager_UpdatePod_Call) Run(run func(_a0 *v1.Pod)) *MockManager_UpdatePod_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*v1.Pod))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_UpdatePod_Call) Return() *MockManager_UpdatePod_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockManager_UpdatePod_Call) RunAndReturn(run func(*v1.Pod)) *MockManager_UpdatePod_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockManager creates a new instance of MockManager. 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 NewMockManager(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockManager {
|
||||
mock := &MockManager{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager) EXPECT() *MockManagerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// AddPod mocks base method.
|
||||
func (m *MockManager) AddPod(pod *v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "AddPod", pod)
|
||||
}
|
||||
|
||||
// AddPod indicates an expected call of AddPod.
|
||||
func (mr *MockManagerMockRecorder) AddPod(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPod", reflect.TypeOf((*MockManager)(nil).AddPod), pod)
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod mocks base method.
|
||||
func (m *MockManager) GetMirrorPodByPod(arg0 *v1.Pod) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetMirrorPodByPod", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod indicates an expected call of GetMirrorPodByPod.
|
||||
func (mr *MockManagerMockRecorder) GetMirrorPodByPod(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMirrorPodByPod", reflect.TypeOf((*MockManager)(nil).GetMirrorPodByPod), arg0)
|
||||
}
|
||||
|
||||
// GetPodAndMirrorPod mocks base method.
|
||||
func (m *MockManager) GetPodAndMirrorPod(arg0 *v1.Pod) (*v1.Pod, *v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodAndMirrorPod", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(*v1.Pod)
|
||||
ret2, _ := ret[2].(bool)
|
||||
return ret0, ret1, ret2
|
||||
}
|
||||
|
||||
// GetPodAndMirrorPod indicates an expected call of GetPodAndMirrorPod.
|
||||
func (mr *MockManagerMockRecorder) GetPodAndMirrorPod(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodAndMirrorPod", reflect.TypeOf((*MockManager)(nil).GetPodAndMirrorPod), arg0)
|
||||
}
|
||||
|
||||
// GetPodByFullName mocks base method.
|
||||
func (m *MockManager) GetPodByFullName(podFullName string) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByFullName", podFullName)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByFullName indicates an expected call of GetPodByFullName.
|
||||
func (mr *MockManagerMockRecorder) GetPodByFullName(podFullName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByFullName", reflect.TypeOf((*MockManager)(nil).GetPodByFullName), podFullName)
|
||||
}
|
||||
|
||||
// GetPodByMirrorPod mocks base method.
|
||||
func (m *MockManager) GetPodByMirrorPod(arg0 *v1.Pod) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByMirrorPod", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByMirrorPod indicates an expected call of GetPodByMirrorPod.
|
||||
func (mr *MockManagerMockRecorder) GetPodByMirrorPod(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByMirrorPod", reflect.TypeOf((*MockManager)(nil).GetPodByMirrorPod), arg0)
|
||||
}
|
||||
|
||||
// GetPodByName mocks base method.
|
||||
func (m *MockManager) GetPodByName(namespace, name string) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByName", namespace, name)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByName indicates an expected call of GetPodByName.
|
||||
func (mr *MockManagerMockRecorder) GetPodByName(namespace, name any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByName", reflect.TypeOf((*MockManager)(nil).GetPodByName), namespace, name)
|
||||
}
|
||||
|
||||
// GetPodByUID mocks base method.
|
||||
func (m *MockManager) GetPodByUID(arg0 types.UID) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByUID", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByUID indicates an expected call of GetPodByUID.
|
||||
func (mr *MockManagerMockRecorder) GetPodByUID(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByUID", reflect.TypeOf((*MockManager)(nil).GetPodByUID), arg0)
|
||||
}
|
||||
|
||||
// GetPods mocks base method.
|
||||
func (m *MockManager) GetPods() []*v1.Pod {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPods")
|
||||
ret0, _ := ret[0].([]*v1.Pod)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetPods indicates an expected call of GetPods.
|
||||
func (mr *MockManagerMockRecorder) GetPods() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPods", reflect.TypeOf((*MockManager)(nil).GetPods))
|
||||
}
|
||||
|
||||
// GetPodsAndMirrorPods mocks base method.
|
||||
func (m *MockManager) GetPodsAndMirrorPods() ([]*v1.Pod, []*v1.Pod, []string) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodsAndMirrorPods")
|
||||
ret0, _ := ret[0].([]*v1.Pod)
|
||||
ret1, _ := ret[1].([]*v1.Pod)
|
||||
ret2, _ := ret[2].([]string)
|
||||
return ret0, ret1, ret2
|
||||
}
|
||||
|
||||
// GetPodsAndMirrorPods indicates an expected call of GetPodsAndMirrorPods.
|
||||
func (mr *MockManagerMockRecorder) GetPodsAndMirrorPods() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodsAndMirrorPods", reflect.TypeOf((*MockManager)(nil).GetPodsAndMirrorPods))
|
||||
}
|
||||
|
||||
// GetUIDTranslations mocks base method.
|
||||
func (m *MockManager) GetUIDTranslations() (map[types0.ResolvedPodUID]types0.MirrorPodUID, map[types0.MirrorPodUID]types0.ResolvedPodUID) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetUIDTranslations")
|
||||
ret0, _ := ret[0].(map[types0.ResolvedPodUID]types0.MirrorPodUID)
|
||||
ret1, _ := ret[1].(map[types0.MirrorPodUID]types0.ResolvedPodUID)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetUIDTranslations indicates an expected call of GetUIDTranslations.
|
||||
func (mr *MockManagerMockRecorder) GetUIDTranslations() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUIDTranslations", reflect.TypeOf((*MockManager)(nil).GetUIDTranslations))
|
||||
}
|
||||
|
||||
// RemovePod mocks base method.
|
||||
func (m *MockManager) RemovePod(pod *v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RemovePod", pod)
|
||||
}
|
||||
|
||||
// RemovePod indicates an expected call of RemovePod.
|
||||
func (mr *MockManagerMockRecorder) RemovePod(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePod", reflect.TypeOf((*MockManager)(nil).RemovePod), pod)
|
||||
}
|
||||
|
||||
// SetPods mocks base method.
|
||||
func (m *MockManager) SetPods(pods []*v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetPods", pods)
|
||||
}
|
||||
|
||||
// SetPods indicates an expected call of SetPods.
|
||||
func (mr *MockManagerMockRecorder) SetPods(pods any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPods", reflect.TypeOf((*MockManager)(nil).SetPods), pods)
|
||||
}
|
||||
|
||||
// TranslatePodUID mocks base method.
|
||||
func (m *MockManager) TranslatePodUID(uid types.UID) types0.ResolvedPodUID {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "TranslatePodUID", uid)
|
||||
ret0, _ := ret[0].(types0.ResolvedPodUID)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// TranslatePodUID indicates an expected call of TranslatePodUID.
|
||||
func (mr *MockManagerMockRecorder) TranslatePodUID(uid any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TranslatePodUID", reflect.TypeOf((*MockManager)(nil).TranslatePodUID), uid)
|
||||
}
|
||||
|
||||
// UpdatePod mocks base method.
|
||||
func (m *MockManager) UpdatePod(pod *v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "UpdatePod", pod)
|
||||
}
|
||||
|
||||
// UpdatePod indicates an expected call of UpdatePod.
|
||||
func (mr *MockManagerMockRecorder) UpdatePod(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePod", reflect.TypeOf((*MockManager)(nil).UpdatePod), pod)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
|
||||
cadvisorapi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"go.uber.org/mock/gomock"
|
||||
"k8s.io/mount-utils"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@@ -57,20 +56,18 @@ import (
|
||||
|
||||
func TestRunOnce(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
cadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
cadvisor.EXPECT().MachineInfo().Return(&cadvisorapi.MachineInfo{}, nil).AnyTimes()
|
||||
cadvisor := cadvisortest.NewMockInterface(t)
|
||||
cadvisor.EXPECT().MachineInfo().Return(&cadvisorapi.MachineInfo{}, nil).Maybe()
|
||||
cadvisor.EXPECT().ImagesFsInfo().Return(cadvisorapiv2.FsInfo{
|
||||
Usage: 400,
|
||||
Capacity: 1000,
|
||||
Available: 600,
|
||||
}, nil).AnyTimes()
|
||||
}, nil).Maybe()
|
||||
cadvisor.EXPECT().RootFsInfo().Return(cadvisorapiv2.FsInfo{
|
||||
Usage: 9,
|
||||
Capacity: 10,
|
||||
}, nil).AnyTimes()
|
||||
}, nil).Maybe()
|
||||
fakeSecretManager := secret.NewFakeManager()
|
||||
fakeConfigMapManager := configmap.NewFakeManager()
|
||||
clusterTrustBundleManager := &clustertrustbundle.NoopManager{}
|
||||
|
||||
13
pkg/kubelet/server/stats/.mockery.yaml
Normal file
13
pkg/kubelet/server/stats/.mockery.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: "mock_{{.InterfaceName | snakecase}}.go"
|
||||
boilerplate-file: ../../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/server/stats:
|
||||
interfaces:
|
||||
Provider:
|
||||
config:
|
||||
filename: mock_stats_provider.go
|
||||
SummaryProvider:
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=handler.go -destination=testing/mock_stats_provider.go -package=testing Provider
|
||||
//go:generate mockery
|
||||
package stats
|
||||
|
||||
import (
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=summary.go -destination=testing/mock_summary_provider.go -package=testing SummaryProvider
|
||||
//go:generate mockery
|
||||
package stats
|
||||
|
||||
import (
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
|
||||
fuzz "github.com/google/gofuzz"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -72,14 +71,12 @@ func TestSummaryProviderGetStatsNoSplitFileSystem(t *testing.T) {
|
||||
"/pods": {cs: getContainerStats(), ns: getNetworkStats()},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
mockStatsProvider.EXPECT().GetNode().Return(node, nil)
|
||||
mockStatsProvider.EXPECT().GetNodeConfig().Return(nodeConfig)
|
||||
mockStatsProvider.EXPECT().GetPodCgroupRoot().Return(cgroupRoot)
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil)
|
||||
mockStatsProvider.EXPECT().ImageFsStats(ctx).Return(imageFsStats, imageFsStats, nil)
|
||||
mockStatsProvider.EXPECT().RootFsStats().Return(rootFsStats, nil)
|
||||
@@ -169,14 +166,12 @@ func TestSummaryProviderGetStatsSplitImageFs(t *testing.T) {
|
||||
"/pods": {cs: getContainerStats(), ns: getNetworkStats()},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
mockStatsProvider.EXPECT().GetNode().Return(node, nil)
|
||||
mockStatsProvider.EXPECT().GetNodeConfig().Return(nodeConfig)
|
||||
mockStatsProvider.EXPECT().GetPodCgroupRoot().Return(cgroupRoot)
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil)
|
||||
mockStatsProvider.EXPECT().RootFsStats().Return(rootFsStats, nil)
|
||||
mockStatsProvider.EXPECT().RlimitStats().Return(rlimitStats, nil)
|
||||
@@ -265,9 +260,7 @@ func TestSummaryProviderGetCPUAndMemoryStats(t *testing.T) {
|
||||
"/pods": {cs: getVolumeCPUAndMemoryStats()},
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
|
||||
mockStatsProvider.EXPECT().GetNode().Return(node, nil)
|
||||
mockStatsProvider.EXPECT().GetNodeConfig().Return(nodeConfig)
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
|
||||
fuzz "github.com/google/gofuzz"
|
||||
"github.com/stretchr/testify/assert"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -55,19 +54,16 @@ func TestSummaryProvider(t *testing.T) {
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
mockStatsProvider := statstest.NewMockProvider(mockCtrl)
|
||||
mockStatsProvider.EXPECT().GetNode().Return(node, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().GetNodeConfig().Return(nodeConfig).AnyTimes()
|
||||
mockStatsProvider.EXPECT().GetPodCgroupRoot().Return(cgroupRoot).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().ImageFsStats(ctx).Return(imageFsStats, imageFsStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().RootFsStats().Return(rootFsStats, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().RlimitStats().Return(nil, nil).AnyTimes()
|
||||
mockStatsProvider.EXPECT().GetCgroupStats("/", true).Return(cgroupStatsMap["/"].cs, cgroupStatsMap["/"].ns, nil).AnyTimes()
|
||||
mockStatsProvider := statstest.NewMockProvider(t)
|
||||
mockStatsProvider.EXPECT().GetNode().Return(node, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().GetNodeConfig().Return(nodeConfig).Maybe()
|
||||
mockStatsProvider.EXPECT().GetPodCgroupRoot().Return(cgroupRoot).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStats(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ListPodStatsAndUpdateCPUNanoCoreUsage(ctx).Return(podStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().ImageFsStats(ctx).Return(imageFsStats, imageFsStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().RootFsStats().Return(rootFsStats, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().RlimitStats().Return(nil, nil).Maybe()
|
||||
mockStatsProvider.EXPECT().GetCgroupStats("/", true).Return(cgroupStatsMap["/"].cs, cgroupStatsMap["/"].ns, nil).Maybe()
|
||||
|
||||
kubeletCreationTime := metav1.Now()
|
||||
systemBootTime := metav1.Now()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,74 +14,158 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: summary.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=summary.go -destination=testing/mock_summary_provider.go -package=testing SummaryProvider
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
v1alpha1 "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
|
||||
)
|
||||
|
||||
// MockSummaryProvider is a mock of SummaryProvider interface.
|
||||
// MockSummaryProvider is an autogenerated mock type for the SummaryProvider type
|
||||
type MockSummaryProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSummaryProviderMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockSummaryProviderMockRecorder is the mock recorder for MockSummaryProvider.
|
||||
type MockSummaryProviderMockRecorder struct {
|
||||
mock *MockSummaryProvider
|
||||
type MockSummaryProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockSummaryProvider creates a new mock instance.
|
||||
func NewMockSummaryProvider(ctrl *gomock.Controller) *MockSummaryProvider {
|
||||
mock := &MockSummaryProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockSummaryProviderMockRecorder{mock}
|
||||
func (_m *MockSummaryProvider) EXPECT() *MockSummaryProvider_Expecter {
|
||||
return &MockSummaryProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Get provides a mock function with given fields: ctx, updateStats
|
||||
func (_m *MockSummaryProvider) Get(ctx context.Context, updateStats bool) (*v1alpha1.Summary, error) {
|
||||
ret := _m.Called(ctx, updateStats)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Get")
|
||||
}
|
||||
|
||||
var r0 *v1alpha1.Summary
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, bool) (*v1alpha1.Summary, error)); ok {
|
||||
return rf(ctx, updateStats)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(context.Context, bool) *v1alpha1.Summary); ok {
|
||||
r0 = rf(ctx, updateStats)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1alpha1.Summary)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(context.Context, bool) error); ok {
|
||||
r1 = rf(ctx, updateStats)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockSummaryProvider_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
||||
type MockSummaryProvider_Get_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Get is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - updateStats bool
|
||||
func (_e *MockSummaryProvider_Expecter) Get(ctx interface{}, updateStats interface{}) *MockSummaryProvider_Get_Call {
|
||||
return &MockSummaryProvider_Get_Call{Call: _e.mock.On("Get", ctx, updateStats)}
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_Get_Call) Run(run func(ctx context.Context, updateStats bool)) *MockSummaryProvider_Get_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(bool))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_Get_Call) Return(_a0 *v1alpha1.Summary, _a1 error) *MockSummaryProvider_Get_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_Get_Call) RunAndReturn(run func(context.Context, bool) (*v1alpha1.Summary, error)) *MockSummaryProvider_Get_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetCPUAndMemoryStats provides a mock function with given fields: ctx
|
||||
func (_m *MockSummaryProvider) GetCPUAndMemoryStats(ctx context.Context) (*v1alpha1.Summary, error) {
|
||||
ret := _m.Called(ctx)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetCPUAndMemoryStats")
|
||||
}
|
||||
|
||||
var r0 *v1alpha1.Summary
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context) (*v1alpha1.Summary, error)); ok {
|
||||
return rf(ctx)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(context.Context) *v1alpha1.Summary); ok {
|
||||
r0 = rf(ctx)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*v1alpha1.Summary)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
||||
r1 = rf(ctx)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockSummaryProvider_GetCPUAndMemoryStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCPUAndMemoryStats'
|
||||
type MockSummaryProvider_GetCPUAndMemoryStats_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetCPUAndMemoryStats is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *MockSummaryProvider_Expecter) GetCPUAndMemoryStats(ctx interface{}) *MockSummaryProvider_GetCPUAndMemoryStats_Call {
|
||||
return &MockSummaryProvider_GetCPUAndMemoryStats_Call{Call: _e.mock.On("GetCPUAndMemoryStats", ctx)}
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_GetCPUAndMemoryStats_Call) Run(run func(ctx context.Context)) *MockSummaryProvider_GetCPUAndMemoryStats_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_GetCPUAndMemoryStats_Call) Return(_a0 *v1alpha1.Summary, _a1 error) *MockSummaryProvider_GetCPUAndMemoryStats_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSummaryProvider_GetCPUAndMemoryStats_Call) RunAndReturn(run func(context.Context) (*v1alpha1.Summary, error)) *MockSummaryProvider_GetCPUAndMemoryStats_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockSummaryProvider creates a new instance of MockSummaryProvider. 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 NewMockSummaryProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockSummaryProvider {
|
||||
mock := &MockSummaryProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockSummaryProvider) EXPECT() *MockSummaryProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Get mocks base method.
|
||||
func (m *MockSummaryProvider) Get(ctx context.Context, updateStats bool) (*v1alpha1.Summary, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Get", ctx, updateStats)
|
||||
ret0, _ := ret[0].(*v1alpha1.Summary)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get.
|
||||
func (mr *MockSummaryProviderMockRecorder) Get(ctx, updateStats any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockSummaryProvider)(nil).Get), ctx, updateStats)
|
||||
}
|
||||
|
||||
// GetCPUAndMemoryStats mocks base method.
|
||||
func (m *MockSummaryProvider) GetCPUAndMemoryStats(ctx context.Context) (*v1alpha1.Summary, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetCPUAndMemoryStats", ctx)
|
||||
ret0, _ := ret[0].(*v1alpha1.Summary)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetCPUAndMemoryStats indicates an expected call of GetCPUAndMemoryStats.
|
||||
func (mr *MockSummaryProviderMockRecorder) GetCPUAndMemoryStats(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCPUAndMemoryStats", reflect.TypeOf((*MockSummaryProvider)(nil).GetCPUAndMemoryStats), ctx)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
csipbv1 "github.com/container-storage-interface/spec/lib/go/csi"
|
||||
k8sv1 "k8s.io/api/core/v1"
|
||||
@@ -105,11 +104,8 @@ var (
|
||||
)
|
||||
|
||||
func TestPVCRef(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
// Setup mock stats provider
|
||||
mockStats := statstest.NewMockProvider(mockCtrl)
|
||||
mockStats := statstest.NewMockProvider(t)
|
||||
volumes := map[string]volume.Volume{vol0: &fakeVolume{}, vol1: &fakeVolume{}, vol3: &fakeVolume{}}
|
||||
mockStats.EXPECT().ListVolumesForPod(fakePod.UID).Return(volumes, true)
|
||||
blockVolumes := map[string]volume.BlockVolume{vol2: &fakeBlockVolume{}}
|
||||
@@ -165,9 +161,7 @@ func TestPVCRef(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalVolumeEvent(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
mockStats := statstest.NewMockProvider(mockCtrl)
|
||||
mockStats := statstest.NewMockProvider(t)
|
||||
|
||||
volumes := map[string]volume.Volume{vol0: &fakeVolume{}, vol1: &fakeVolume{}}
|
||||
mockStats.EXPECT().ListVolumesForPod(fakePod.UID).Return(volumes, true)
|
||||
@@ -190,11 +184,9 @@ func TestNormalVolumeEvent(t *testing.T) {
|
||||
|
||||
func TestAbnormalVolumeEvent(t *testing.T) {
|
||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIVolumeHealth, true)
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
// Setup mock stats provider
|
||||
mockStats := statstest.NewMockProvider(mockCtrl)
|
||||
mockStats := statstest.NewMockProvider(t)
|
||||
volumes := map[string]volume.Volume{vol0: &fakeVolume{}}
|
||||
mockStats.EXPECT().ListVolumesForPod(fakePod.UID).Return(volumes, true)
|
||||
blockVolumes := map[string]volume.BlockVolume{vol1: &fakeBlockVolume{}}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -245,15 +244,12 @@ func TestCadvisorListPodStats(t *testing.T) {
|
||||
Recursive: true,
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
mockCadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor := cadvisortest.NewMockInterface(t)
|
||||
mockCadvisor.EXPECT().ContainerInfoV2("/", options).Return(infos, nil)
|
||||
mockCadvisor.EXPECT().RootFsInfo().Return(rootfs, nil)
|
||||
mockCadvisor.EXPECT().ImagesFsInfo().Return(imagefs, nil)
|
||||
|
||||
mockRuntime := containertest.NewMockRuntime(mockCtrl)
|
||||
mockRuntime := containertest.NewMockRuntime(t)
|
||||
|
||||
ephemeralVolumes := []statsapi.VolumeStats{getPodVolumeStats(seedEphemeralVolume1, "ephemeralVolume1"),
|
||||
getPodVolumeStats(seedEphemeralVolume2, "ephemeralVolume2")}
|
||||
@@ -267,7 +263,7 @@ func TestCadvisorListPodStats(t *testing.T) {
|
||||
p1Time := metav1.Now()
|
||||
p2Time := metav1.Now()
|
||||
p3Time := metav1.Now()
|
||||
mockStatus := statustest.NewMockPodStatusProvider(mockCtrl)
|
||||
mockStatus := statustest.NewMockPodStatusProvider(t)
|
||||
mockStatus.EXPECT().GetPodStatus(types.UID("UID"+pName0)).Return(v1.PodStatus{StartTime: &p0Time}, true)
|
||||
mockStatus.EXPECT().GetPodStatus(types.UID("UID"+pName1)).Return(v1.PodStatus{StartTime: &p1Time}, true)
|
||||
mockStatus.EXPECT().GetPodStatus(types.UID("UID"+pName2)).Return(v1.PodStatus{StartTime: &p2Time}, true)
|
||||
@@ -434,10 +430,7 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
|
||||
Recursive: true,
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
mockCadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor := cadvisortest.NewMockInterface(t)
|
||||
mockCadvisor.EXPECT().ContainerInfoV2("/", options).Return(infos, nil)
|
||||
|
||||
ephemeralVolumes := []statsapi.VolumeStats{getPodVolumeStats(seedEphemeralVolume1, "ephemeralVolume1"),
|
||||
@@ -525,12 +518,10 @@ func TestCadvisorListPodCPUAndMemoryStats(t *testing.T) {
|
||||
|
||||
func TestCadvisorImagesFsStatsKubeletSeparateDiskOff(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
var (
|
||||
assert = assert.New(t)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockRuntime = containertest.NewMockRuntime(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntime = containertest.NewMockRuntime(t)
|
||||
|
||||
seed = 1000
|
||||
imageFsInfo = getTestFsInfo(seed)
|
||||
@@ -557,12 +548,10 @@ func TestCadvisorImagesFsStatsKubeletSeparateDiskOff(t *testing.T) {
|
||||
|
||||
func TestCadvisorImagesFsStats(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
var (
|
||||
assert = assert.New(t)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockRuntime = containertest.NewMockRuntime(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntime = containertest.NewMockRuntime(t)
|
||||
|
||||
seed = 1000
|
||||
imageFsInfo = getTestFsInfo(seed)
|
||||
@@ -605,12 +594,10 @@ func TestCadvisorImagesFsStats(t *testing.T) {
|
||||
|
||||
func TestCadvisorSplitImagesFsStats(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
var (
|
||||
assert = assert.New(t)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockRuntime = containertest.NewMockRuntime(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntime = containertest.NewMockRuntime(t)
|
||||
|
||||
seed = 1000
|
||||
imageFsInfo = getTestFsInfo(seed)
|
||||
@@ -736,20 +723,17 @@ func TestCadvisorListPodStatsWhenContainerLogFound(t *testing.T) {
|
||||
Recursive: true,
|
||||
}
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
mockCadvisor := cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor := cadvisortest.NewMockInterface(t)
|
||||
mockCadvisor.EXPECT().ContainerInfoV2("/", options).Return(infos, nil)
|
||||
mockCadvisor.EXPECT().RootFsInfo().Return(rootfs, nil)
|
||||
mockCadvisor.EXPECT().ImagesFsInfo().Return(imagefs, nil)
|
||||
|
||||
mockRuntime := containertest.NewMockRuntime(mockCtrl)
|
||||
mockRuntime.EXPECT().ImageStats(ctx).Return(&kubecontainer.ImageStats{TotalStorageBytes: 123}, nil).AnyTimes()
|
||||
mockRuntime := containertest.NewMockRuntime(t)
|
||||
mockRuntime.EXPECT().ImageStats(ctx).Return(&kubecontainer.ImageStats{TotalStorageBytes: 123}, nil).Maybe()
|
||||
|
||||
volumeStats := serverstats.PodVolumeStats{}
|
||||
p0Time := metav1.Now()
|
||||
mockStatus := statustest.NewMockPodStatusProvider(mockCtrl)
|
||||
mockStatus := statustest.NewMockPodStatusProvider(t)
|
||||
mockStatus.EXPECT().GetPodStatus(types.UID("UID"+pName0)).Return(v1.PodStatus{StartTime: &p0Time}, true)
|
||||
|
||||
resourceAnalyzer := &fakeResourceAnalyzer{podVolumeStats: volumeStats}
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
cadvisorfs "github.com/google/cadvisor/fs"
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -148,11 +147,8 @@ func TestCRIListPodStats(t *testing.T) {
|
||||
podLogStats1 = makeFakeLogStats(6000)
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
resourceAnalyzer = new(fakeResourceAnalyzer)
|
||||
@@ -216,13 +212,10 @@ func TestCRIListPodStats(t *testing.T) {
|
||||
filepath.Join(kuberuntime.BuildPodLogsDirectory(testPodLogDirectory, "sandbox1-ns", "sandbox1-name", types.UID("sandbox1-uid")), podLogName1): podLogStats1,
|
||||
}
|
||||
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
|
||||
fakeOS := &kubecontainertest.FakeOS{}
|
||||
fakeOS.ReadDirFn = func(path string) ([]os.DirEntry, error) {
|
||||
var dirEntries []os.DirEntry
|
||||
mockDE := kubecontainertest.NewMockDirEntry(ctrl)
|
||||
mockDE := kubecontainertest.NewMockDirEntry(t)
|
||||
switch path {
|
||||
case kuberuntime.BuildPodLogsDirectory(testPodLogDirectory, "sandbox0-ns", "sandbox0-name", types.UID("sandbox0-uid")):
|
||||
mockDE.EXPECT().Name().Return(podLogName0)
|
||||
@@ -373,10 +366,8 @@ func TestListPodStatsStrictlyFromCRI(t *testing.T) {
|
||||
podLogStats0 = makeFakeLogStats(5000)
|
||||
podLogStats1 = makeFakeLogStats(6000)
|
||||
)
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
resourceAnalyzer = new(fakeResourceAnalyzer)
|
||||
@@ -443,12 +434,10 @@ func TestListPodStatsStrictlyFromCRI(t *testing.T) {
|
||||
filepath.Join(kuberuntime.BuildPodLogsDirectory(testPodLogDirectory, "sandbox0-ns", "sandbox0-name", types.UID("sandbox0-uid")), podLogName0): podLogStats0,
|
||||
filepath.Join(kuberuntime.BuildPodLogsDirectory(testPodLogDirectory, "sandbox1-ns", "sandbox1-name", types.UID("sandbox1-uid")), podLogName1): podLogStats1,
|
||||
}
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
fakeOS := &kubecontainertest.FakeOS{}
|
||||
fakeOS.ReadDirFn = func(path string) ([]os.DirEntry, error) {
|
||||
var dirEntries []os.DirEntry
|
||||
mockDE := kubecontainertest.NewMockDirEntry(ctrl)
|
||||
mockDE := kubecontainertest.NewMockDirEntry(t)
|
||||
switch path {
|
||||
case kuberuntime.BuildPodLogsDirectory(testPodLogDirectory, "sandbox0-ns", "sandbox0-name", types.UID("sandbox0-uid")):
|
||||
mockDE.EXPECT().Name().Return(podLogName0)
|
||||
@@ -584,11 +573,8 @@ func TestCRIListPodCPUAndMemoryStats(t *testing.T) {
|
||||
containerStats9 = makeFakeContainerStats(container9, imageFsMountpoint)
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
resourceAnalyzer = new(fakeResourceAnalyzer)
|
||||
@@ -752,11 +738,8 @@ func TestCRIImagesFsStats(t *testing.T) {
|
||||
imageFsUsage = makeFakeImageFsUsage(imageFsMountpoint)
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
resourceAnalyzer = new(fakeResourceAnalyzer)
|
||||
|
||||
@@ -27,7 +27,6 @@ import (
|
||||
fuzz "github.com/google/gofuzz"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@@ -76,11 +75,8 @@ func TestGetCgroupStats(t *testing.T) {
|
||||
updateStats = false
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
|
||||
@@ -113,11 +109,8 @@ func TestGetCgroupCPUAndMemoryStats(t *testing.T) {
|
||||
updateStats = false
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
|
||||
@@ -147,11 +140,8 @@ func TestRootFsStats(t *testing.T) {
|
||||
containerInfoSeed = 2000
|
||||
)
|
||||
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
|
||||
@@ -179,8 +169,6 @@ func TestRootFsStats(t *testing.T) {
|
||||
|
||||
func TestHasDedicatedImageFs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
imageStatsExpected := &statsapi.FsStats{AvailableBytes: uint64Ptr(1)}
|
||||
|
||||
for desc, test := range map[string]struct {
|
||||
@@ -213,7 +201,7 @@ func TestHasDedicatedImageFs(t *testing.T) {
|
||||
} {
|
||||
t.Logf("TestCase %q", desc)
|
||||
var (
|
||||
mockCadvisor = cadvisortest.NewMockInterface(mockCtrl)
|
||||
mockCadvisor = cadvisortest.NewMockInterface(t)
|
||||
mockPodManager = new(kubepodtest.MockManager)
|
||||
mockRuntimeCache = new(kubecontainertest.MockRuntimeCache)
|
||||
)
|
||||
|
||||
10
pkg/kubelet/status/.mockery.yaml
Normal file
10
pkg/kubelet/status/.mockery.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
dir: testing
|
||||
filename: "mock_{{.InterfaceName | snakecase}}.go"
|
||||
boilerplate-file: ../../../hack/boilerplate/boilerplate.generatego.txt
|
||||
outpkg: testing
|
||||
with-expecter: true
|
||||
packages:
|
||||
k8s.io/kubernetes/pkg/kubelet/status:
|
||||
interfaces:
|
||||
PodStatusProvider:
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//go:generate mockgen -source=status_manager.go -destination=testing/mock_pod_status_provider.go -package=testing PodStatusProvider
|
||||
//go:generate mockery
|
||||
package status
|
||||
|
||||
import (
|
||||
|
||||
@@ -14,395 +14,97 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: status_manager.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -source=status_manager.go -destination=testing/mock_pod_status_provider.go -package=testing PodStatusProvider
|
||||
//
|
||||
// Code generated by mockery v2.40.3. DO NOT EDIT.
|
||||
|
||||
// Package testing is a generated GoMock package.
|
||||
package testing
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
container "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
types0 "k8s.io/kubernetes/pkg/kubelet/types"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// MockPodManager is a mock of PodManager interface.
|
||||
type MockPodManager struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPodManagerMockRecorder
|
||||
}
|
||||
|
||||
// MockPodManagerMockRecorder is the mock recorder for MockPodManager.
|
||||
type MockPodManagerMockRecorder struct {
|
||||
mock *MockPodManager
|
||||
}
|
||||
|
||||
// NewMockPodManager creates a new mock instance.
|
||||
func NewMockPodManager(ctrl *gomock.Controller) *MockPodManager {
|
||||
mock := &MockPodManager{ctrl: ctrl}
|
||||
mock.recorder = &MockPodManagerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockPodManager) EXPECT() *MockPodManagerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod mocks base method.
|
||||
func (m *MockPodManager) GetMirrorPodByPod(arg0 *v1.Pod) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetMirrorPodByPod", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetMirrorPodByPod indicates an expected call of GetMirrorPodByPod.
|
||||
func (mr *MockPodManagerMockRecorder) GetMirrorPodByPod(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMirrorPodByPod", reflect.TypeOf((*MockPodManager)(nil).GetMirrorPodByPod), arg0)
|
||||
}
|
||||
|
||||
// GetPodByUID mocks base method.
|
||||
func (m *MockPodManager) GetPodByUID(arg0 types.UID) (*v1.Pod, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodByUID", arg0)
|
||||
ret0, _ := ret[0].(*v1.Pod)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodByUID indicates an expected call of GetPodByUID.
|
||||
func (mr *MockPodManagerMockRecorder) GetPodByUID(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodByUID", reflect.TypeOf((*MockPodManager)(nil).GetPodByUID), arg0)
|
||||
}
|
||||
|
||||
// GetUIDTranslations mocks base method.
|
||||
func (m *MockPodManager) GetUIDTranslations() (map[types0.ResolvedPodUID]types0.MirrorPodUID, map[types0.MirrorPodUID]types0.ResolvedPodUID) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetUIDTranslations")
|
||||
ret0, _ := ret[0].(map[types0.ResolvedPodUID]types0.MirrorPodUID)
|
||||
ret1, _ := ret[1].(map[types0.MirrorPodUID]types0.ResolvedPodUID)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetUIDTranslations indicates an expected call of GetUIDTranslations.
|
||||
func (mr *MockPodManagerMockRecorder) GetUIDTranslations() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUIDTranslations", reflect.TypeOf((*MockPodManager)(nil).GetUIDTranslations))
|
||||
}
|
||||
|
||||
// TranslatePodUID mocks base method.
|
||||
func (m *MockPodManager) TranslatePodUID(uid types.UID) types0.ResolvedPodUID {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "TranslatePodUID", uid)
|
||||
ret0, _ := ret[0].(types0.ResolvedPodUID)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// TranslatePodUID indicates an expected call of TranslatePodUID.
|
||||
func (mr *MockPodManagerMockRecorder) TranslatePodUID(uid any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TranslatePodUID", reflect.TypeOf((*MockPodManager)(nil).TranslatePodUID), uid)
|
||||
}
|
||||
|
||||
// MockPodStatusProvider is a mock of PodStatusProvider interface.
|
||||
// MockPodStatusProvider is an autogenerated mock type for the PodStatusProvider type
|
||||
type MockPodStatusProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPodStatusProviderMockRecorder
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MockPodStatusProviderMockRecorder is the mock recorder for MockPodStatusProvider.
|
||||
type MockPodStatusProviderMockRecorder struct {
|
||||
mock *MockPodStatusProvider
|
||||
type MockPodStatusProvider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
// NewMockPodStatusProvider creates a new mock instance.
|
||||
func NewMockPodStatusProvider(ctrl *gomock.Controller) *MockPodStatusProvider {
|
||||
mock := &MockPodStatusProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockPodStatusProviderMockRecorder{mock}
|
||||
func (_m *MockPodStatusProvider) EXPECT() *MockPodStatusProvider_Expecter {
|
||||
return &MockPodStatusProvider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetPodStatus provides a mock function with given fields: uid
|
||||
func (_m *MockPodStatusProvider) GetPodStatus(uid types.UID) (v1.PodStatus, bool) {
|
||||
ret := _m.Called(uid)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetPodStatus")
|
||||
}
|
||||
|
||||
var r0 v1.PodStatus
|
||||
var r1 bool
|
||||
if rf, ok := ret.Get(0).(func(types.UID) (v1.PodStatus, bool)); ok {
|
||||
return rf(uid)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(types.UID) v1.PodStatus); ok {
|
||||
r0 = rf(uid)
|
||||
} else {
|
||||
r0 = ret.Get(0).(v1.PodStatus)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(types.UID) bool); ok {
|
||||
r1 = rf(uid)
|
||||
} else {
|
||||
r1 = ret.Get(1).(bool)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockPodStatusProvider_GetPodStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPodStatus'
|
||||
type MockPodStatusProvider_GetPodStatus_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetPodStatus is a helper method to define mock.On call
|
||||
// - uid types.UID
|
||||
func (_e *MockPodStatusProvider_Expecter) GetPodStatus(uid interface{}) *MockPodStatusProvider_GetPodStatus_Call {
|
||||
return &MockPodStatusProvider_GetPodStatus_Call{Call: _e.mock.On("GetPodStatus", uid)}
|
||||
}
|
||||
|
||||
func (_c *MockPodStatusProvider_GetPodStatus_Call) Run(run func(uid types.UID)) *MockPodStatusProvider_GetPodStatus_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(types.UID))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodStatusProvider_GetPodStatus_Call) Return(_a0 v1.PodStatus, _a1 bool) *MockPodStatusProvider_GetPodStatus_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockPodStatusProvider_GetPodStatus_Call) RunAndReturn(run func(types.UID) (v1.PodStatus, bool)) *MockPodStatusProvider_GetPodStatus_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockPodStatusProvider creates a new instance of MockPodStatusProvider. 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 NewMockPodStatusProvider(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockPodStatusProvider {
|
||||
mock := &MockPodStatusProvider{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockPodStatusProvider) EXPECT() *MockPodStatusProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetPodStatus mocks base method.
|
||||
func (m *MockPodStatusProvider) GetPodStatus(uid types.UID) (v1.PodStatus, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodStatus", uid)
|
||||
ret0, _ := ret[0].(v1.PodStatus)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodStatus indicates an expected call of GetPodStatus.
|
||||
func (mr *MockPodStatusProviderMockRecorder) GetPodStatus(uid any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodStatus", reflect.TypeOf((*MockPodStatusProvider)(nil).GetPodStatus), uid)
|
||||
}
|
||||
|
||||
// MockPodDeletionSafetyProvider is a mock of PodDeletionSafetyProvider interface.
|
||||
type MockPodDeletionSafetyProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPodDeletionSafetyProviderMockRecorder
|
||||
}
|
||||
|
||||
// MockPodDeletionSafetyProviderMockRecorder is the mock recorder for MockPodDeletionSafetyProvider.
|
||||
type MockPodDeletionSafetyProviderMockRecorder struct {
|
||||
mock *MockPodDeletionSafetyProvider
|
||||
}
|
||||
|
||||
// NewMockPodDeletionSafetyProvider creates a new mock instance.
|
||||
func NewMockPodDeletionSafetyProvider(ctrl *gomock.Controller) *MockPodDeletionSafetyProvider {
|
||||
mock := &MockPodDeletionSafetyProvider{ctrl: ctrl}
|
||||
mock.recorder = &MockPodDeletionSafetyProviderMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockPodDeletionSafetyProvider) EXPECT() *MockPodDeletionSafetyProviderMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// PodCouldHaveRunningContainers mocks base method.
|
||||
func (m *MockPodDeletionSafetyProvider) PodCouldHaveRunningContainers(pod *v1.Pod) bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "PodCouldHaveRunningContainers", pod)
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// PodCouldHaveRunningContainers indicates an expected call of PodCouldHaveRunningContainers.
|
||||
func (mr *MockPodDeletionSafetyProviderMockRecorder) PodCouldHaveRunningContainers(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PodCouldHaveRunningContainers", reflect.TypeOf((*MockPodDeletionSafetyProvider)(nil).PodCouldHaveRunningContainers), pod)
|
||||
}
|
||||
|
||||
// MockPodStartupLatencyStateHelper is a mock of PodStartupLatencyStateHelper interface.
|
||||
type MockPodStartupLatencyStateHelper struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPodStartupLatencyStateHelperMockRecorder
|
||||
}
|
||||
|
||||
// MockPodStartupLatencyStateHelperMockRecorder is the mock recorder for MockPodStartupLatencyStateHelper.
|
||||
type MockPodStartupLatencyStateHelperMockRecorder struct {
|
||||
mock *MockPodStartupLatencyStateHelper
|
||||
}
|
||||
|
||||
// NewMockPodStartupLatencyStateHelper creates a new mock instance.
|
||||
func NewMockPodStartupLatencyStateHelper(ctrl *gomock.Controller) *MockPodStartupLatencyStateHelper {
|
||||
mock := &MockPodStartupLatencyStateHelper{ctrl: ctrl}
|
||||
mock.recorder = &MockPodStartupLatencyStateHelperMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockPodStartupLatencyStateHelper) EXPECT() *MockPodStartupLatencyStateHelperMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// DeletePodStartupState mocks base method.
|
||||
func (m *MockPodStartupLatencyStateHelper) DeletePodStartupState(podUID types.UID) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "DeletePodStartupState", podUID)
|
||||
}
|
||||
|
||||
// DeletePodStartupState indicates an expected call of DeletePodStartupState.
|
||||
func (mr *MockPodStartupLatencyStateHelperMockRecorder) DeletePodStartupState(podUID any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePodStartupState", reflect.TypeOf((*MockPodStartupLatencyStateHelper)(nil).DeletePodStartupState), podUID)
|
||||
}
|
||||
|
||||
// RecordStatusUpdated mocks base method.
|
||||
func (m *MockPodStartupLatencyStateHelper) RecordStatusUpdated(pod *v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RecordStatusUpdated", pod)
|
||||
}
|
||||
|
||||
// RecordStatusUpdated indicates an expected call of RecordStatusUpdated.
|
||||
func (mr *MockPodStartupLatencyStateHelperMockRecorder) RecordStatusUpdated(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordStatusUpdated", reflect.TypeOf((*MockPodStartupLatencyStateHelper)(nil).RecordStatusUpdated), pod)
|
||||
}
|
||||
|
||||
// MockManager is a mock of Manager interface.
|
||||
type MockManager struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManagerMockRecorder
|
||||
}
|
||||
|
||||
// MockManagerMockRecorder is the mock recorder for MockManager.
|
||||
type MockManagerMockRecorder struct {
|
||||
mock *MockManager
|
||||
}
|
||||
|
||||
// NewMockManager creates a new mock instance.
|
||||
func NewMockManager(ctrl *gomock.Controller) *MockManager {
|
||||
mock := &MockManager{ctrl: ctrl}
|
||||
mock.recorder = &MockManagerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager) EXPECT() *MockManagerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetContainerResourceAllocation mocks base method.
|
||||
func (m *MockManager) GetContainerResourceAllocation(podUID, containerName string) (v1.ResourceList, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetContainerResourceAllocation", podUID, containerName)
|
||||
ret0, _ := ret[0].(v1.ResourceList)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetContainerResourceAllocation indicates an expected call of GetContainerResourceAllocation.
|
||||
func (mr *MockManagerMockRecorder) GetContainerResourceAllocation(podUID, containerName any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContainerResourceAllocation", reflect.TypeOf((*MockManager)(nil).GetContainerResourceAllocation), podUID, containerName)
|
||||
}
|
||||
|
||||
// GetPodResizeStatus mocks base method.
|
||||
func (m *MockManager) GetPodResizeStatus(podUID string) (v1.PodResizeStatus, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodResizeStatus", podUID)
|
||||
ret0, _ := ret[0].(v1.PodResizeStatus)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodResizeStatus indicates an expected call of GetPodResizeStatus.
|
||||
func (mr *MockManagerMockRecorder) GetPodResizeStatus(podUID any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodResizeStatus", reflect.TypeOf((*MockManager)(nil).GetPodResizeStatus), podUID)
|
||||
}
|
||||
|
||||
// GetPodStatus mocks base method.
|
||||
func (m *MockManager) GetPodStatus(uid types.UID) (v1.PodStatus, bool) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetPodStatus", uid)
|
||||
ret0, _ := ret[0].(v1.PodStatus)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetPodStatus indicates an expected call of GetPodStatus.
|
||||
func (mr *MockManagerMockRecorder) GetPodStatus(uid any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPodStatus", reflect.TypeOf((*MockManager)(nil).GetPodStatus), uid)
|
||||
}
|
||||
|
||||
// RemoveOrphanedStatuses mocks base method.
|
||||
func (m *MockManager) RemoveOrphanedStatuses(podUIDs map[types.UID]bool) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RemoveOrphanedStatuses", podUIDs)
|
||||
}
|
||||
|
||||
// RemoveOrphanedStatuses indicates an expected call of RemoveOrphanedStatuses.
|
||||
func (mr *MockManagerMockRecorder) RemoveOrphanedStatuses(podUIDs any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveOrphanedStatuses", reflect.TypeOf((*MockManager)(nil).RemoveOrphanedStatuses), podUIDs)
|
||||
}
|
||||
|
||||
// SetContainerReadiness mocks base method.
|
||||
func (m *MockManager) SetContainerReadiness(podUID types.UID, containerID container.ContainerID, ready bool) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetContainerReadiness", podUID, containerID, ready)
|
||||
}
|
||||
|
||||
// SetContainerReadiness indicates an expected call of SetContainerReadiness.
|
||||
func (mr *MockManagerMockRecorder) SetContainerReadiness(podUID, containerID, ready any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetContainerReadiness", reflect.TypeOf((*MockManager)(nil).SetContainerReadiness), podUID, containerID, ready)
|
||||
}
|
||||
|
||||
// SetContainerStartup mocks base method.
|
||||
func (m *MockManager) SetContainerStartup(podUID types.UID, containerID container.ContainerID, started bool) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetContainerStartup", podUID, containerID, started)
|
||||
}
|
||||
|
||||
// SetContainerStartup indicates an expected call of SetContainerStartup.
|
||||
func (mr *MockManagerMockRecorder) SetContainerStartup(podUID, containerID, started any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetContainerStartup", reflect.TypeOf((*MockManager)(nil).SetContainerStartup), podUID, containerID, started)
|
||||
}
|
||||
|
||||
// SetPodAllocation mocks base method.
|
||||
func (m *MockManager) SetPodAllocation(pod *v1.Pod) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetPodAllocation", pod)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetPodAllocation indicates an expected call of SetPodAllocation.
|
||||
func (mr *MockManagerMockRecorder) SetPodAllocation(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPodAllocation", reflect.TypeOf((*MockManager)(nil).SetPodAllocation), pod)
|
||||
}
|
||||
|
||||
// SetPodResizeStatus mocks base method.
|
||||
func (m *MockManager) SetPodResizeStatus(podUID types.UID, resize v1.PodResizeStatus) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetPodResizeStatus", podUID, resize)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetPodResizeStatus indicates an expected call of SetPodResizeStatus.
|
||||
func (mr *MockManagerMockRecorder) SetPodResizeStatus(podUID, resize any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPodResizeStatus", reflect.TypeOf((*MockManager)(nil).SetPodResizeStatus), podUID, resize)
|
||||
}
|
||||
|
||||
// SetPodStatus mocks base method.
|
||||
func (m *MockManager) SetPodStatus(pod *v1.Pod, status v1.PodStatus) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetPodStatus", pod, status)
|
||||
}
|
||||
|
||||
// SetPodStatus indicates an expected call of SetPodStatus.
|
||||
func (mr *MockManagerMockRecorder) SetPodStatus(pod, status any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPodStatus", reflect.TypeOf((*MockManager)(nil).SetPodStatus), pod, status)
|
||||
}
|
||||
|
||||
// Start mocks base method.
|
||||
func (m *MockManager) Start() {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Start")
|
||||
}
|
||||
|
||||
// Start indicates an expected call of Start.
|
||||
func (mr *MockManagerMockRecorder) Start() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockManager)(nil).Start))
|
||||
}
|
||||
|
||||
// TerminatePod mocks base method.
|
||||
func (m *MockManager) TerminatePod(pod *v1.Pod) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "TerminatePod", pod)
|
||||
}
|
||||
|
||||
// TerminatePod indicates an expected call of TerminatePod.
|
||||
func (mr *MockManagerMockRecorder) TerminatePod(pod any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TerminatePod", reflect.TypeOf((*MockManager)(nil).TerminatePod), pod)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user