kubernetes/pkg/kubelet/container/testing/mock_runtime_cache.go
Stephen Kitt 3f36c83c68
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>
2024-06-20 19:42:53 +02:00

162 lines
4.6 KiB
Go

/*
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 (
context "context"
container "k8s.io/kubernetes/pkg/kubelet/container"
mock "github.com/stretchr/testify/mock"
time "time"
)
// MockRuntimeCache is an autogenerated mock type for the RuntimeCache type
type MockRuntimeCache struct {
mock.Mock
}
type MockRuntimeCache_Expecter struct {
mock *mock.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
}