1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00
node-feature-discovery/mockapihelpers.go
Markus Lehtonen 15f8f4437b Store published label names in annotations
Add new 'nfd.node.kubernetes.io/feature-labels' annotation to store all
the feature labels added by NFD. This annotation is used by NFD by
cleaning up old labels when doing re-labeling.

In this scheme NFD does not need to rely on NFD-specific prefix in
feature label, and, is always able to reliably clean up old label.
2018-11-30 09:56:31 +02:00

98 lines
2.5 KiB
Go

package main
import (
"github.com/stretchr/testify/mock"
api "k8s.io/api/core/v1"
k8sclient "k8s.io/client-go/kubernetes"
)
type MockAPIHelpers struct {
mock.Mock
}
// GetClient provides a mock function with no input arguments and
// *k8sclient.Clientset and error as return value
func (_m *MockAPIHelpers) GetClient() (*k8sclient.Clientset, error) {
ret := _m.Called()
var r0 *k8sclient.Clientset
if rf, ok := ret.Get(0).(func() *k8sclient.Clientset); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*k8sclient.Clientset)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetNode provides a mock function with *k8sclient.Clientset as input
// argument and *api.Node and error as return values
func (_m *MockAPIHelpers) GetNode(_a0 *k8sclient.Clientset) (*api.Node, error) {
ret := _m.Called(_a0)
var r0 *api.Node
if rf, ok := ret.Get(0).(func(*k8sclient.Clientset) *api.Node); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*api.Node)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*k8sclient.Clientset) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RemoveLabelsWithPrefix provides a mock function with *api.Node and main.Labels as the input arguments and
// no return value
func (_m *MockAPIHelpers) RemoveLabelsWithPrefix(_a0 *api.Node, _a1 string) {
_m.Called(_a0, _a1)
}
// RemoveLabels provides a mock function with *api.Node and []strings as the input arguments and
// no return value
func (_m *MockAPIHelpers) RemoveLabels(_a0 *api.Node, _a1 []string) {
_m.Called(_a0, _a1)
}
// AddLabels provides a mock function with *api.Node and main.Labels as the input arguments and
// no return value
func (_m *MockAPIHelpers) AddLabels(_a0 *api.Node, _a1 Labels) {
_m.Called(_a0, _a1)
}
// AddAnnotations provides a mock function with *api.Node and main.Annotations as the input arguments and
// no return value
func (_m *MockAPIHelpers) AddAnnotations(_a0 *api.Node, _a1 Annotations) {
_m.Called(_a0, _a1)
}
// UpdateNode provides a mock function with *k8sclient.Clientset and *api.Node as the input arguments and
// error as the return value
func (_m *MockAPIHelpers) UpdateNode(_a0 *k8sclient.Clientset, _a1 *api.Node) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(*k8sclient.Clientset, *api.Node) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}