Files
kubernetes/pkg/kubelet/status/testing/mock_pod_status_provider.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

111 lines
3.2 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 (
mock "github.com/stretchr/testify/mock"
types "k8s.io/apimachinery/pkg/types"
v1 "k8s.io/api/core/v1"
)
// MockPodStatusProvider is an autogenerated mock type for the PodStatusProvider type
type MockPodStatusProvider struct {
mock.Mock
}
type MockPodStatusProvider_Expecter struct {
mock *mock.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
}