Files
kubernetes/pkg/kubelet/eviction/mock_threshold_notifier_test.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

175 lines
5.1 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 eviction
import (
mock "github.com/stretchr/testify/mock"
v1alpha1 "k8s.io/kubelet/pkg/apis/stats/v1alpha1"
)
// MockThresholdNotifier is an autogenerated mock type for the ThresholdNotifier type
type MockThresholdNotifier struct {
mock.Mock
}
type MockThresholdNotifier_Expecter struct {
mock *mock.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
}