1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-05 16:27:05 +00:00

Re-generate mock sources

Add a new Makefile target for regenerating these files.  Also, add a
note that the files are auto-generated, including instructions how to
re-generate them.

Renames the mock files, using the defaults provided by the mockery tool,
in order to make their generation easier.
This commit is contained in:
Markus Lehtonen 2018-07-09 13:12:11 +03:00
parent effd6d436a
commit 12d6c2410e
6 changed files with 148 additions and 148 deletions

View file

@ -15,3 +15,7 @@ all: image
image:
$(IMAGE_BUILD_CMD) --build-arg NFD_VERSION=$(VERSION) \
-t $(QUAY_DOMAIN_NAME)/$(QUAY_REGISTRY_USER)/$(DOCKER_IMAGE_NAME):$(VERSION) ./
mock:
mockery --name=FeatureSource --dir=source --inpkg --note="Re-generate by running 'make mock'"
mockery --name=APIHelpers --inpkg --note="Re-generate by running 'make mock'"

View file

@ -21,7 +21,7 @@ import (
func TestDiscoveryWithMockSources(t *testing.T) {
Convey("When I discover features from fake source and update the node using fake client", t, func() {
mockFeatureSource := new(MockFeatureSource)
mockFeatureSource := new(source.MockFeatureSource)
fakeFeatureSourceName := string("testSource")
fakeFeatureNames := []string{"testfeature1", "testfeature2", "testfeature3"}
fakeFeatures := source.Features{}

94
mock_APIHelpers.go Normal file
View file

@ -0,0 +1,94 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Re-generate by running 'make mock'
package main
import kubernetes "k8s.io/client-go/kubernetes"
import mock "github.com/stretchr/testify/mock"
import v1 "k8s.io/api/core/v1"
// MockAPIHelpers is an autogenerated mock type for the APIHelpers type
type MockAPIHelpers struct {
mock.Mock
}
// AddAnnotations provides a mock function with given fields: _a0, _a1
func (_m *MockAPIHelpers) AddAnnotations(_a0 *v1.Node, _a1 Annotations) {
_m.Called(_a0, _a1)
}
// AddLabels provides a mock function with given fields: _a0, _a1
func (_m *MockAPIHelpers) AddLabels(_a0 *v1.Node, _a1 Labels) {
_m.Called(_a0, _a1)
}
// GetClient provides a mock function with given fields:
func (_m *MockAPIHelpers) GetClient() (*kubernetes.Clientset, error) {
ret := _m.Called()
var r0 *kubernetes.Clientset
if rf, ok := ret.Get(0).(func() *kubernetes.Clientset); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*kubernetes.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 given fields: _a0
func (_m *MockAPIHelpers) GetNode(_a0 *kubernetes.Clientset) (*v1.Node, error) {
ret := _m.Called(_a0)
var r0 *v1.Node
if rf, ok := ret.Get(0).(func(*kubernetes.Clientset) *v1.Node); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.Node)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*kubernetes.Clientset) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RemoveLabels provides a mock function with given fields: _a0, _a1
func (_m *MockAPIHelpers) RemoveLabels(_a0 *v1.Node, _a1 []string) {
_m.Called(_a0, _a1)
}
// RemoveLabelsWithPrefix provides a mock function with given fields: _a0, _a1
func (_m *MockAPIHelpers) RemoveLabelsWithPrefix(_a0 *v1.Node, _a1 string) {
_m.Called(_a0, _a1)
}
// UpdateNode provides a mock function with given fields: _a0, _a1
func (_m *MockAPIHelpers) UpdateNode(_a0 *kubernetes.Clientset, _a1 *v1.Node) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(*kubernetes.Clientset, *v1.Node) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}

View file

@ -1,98 +0,0 @@
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
}

View file

@ -1,49 +0,0 @@
package main
import (
"sigs.k8s.io/node-feature-discovery/source"
"github.com/stretchr/testify/mock"
)
type MockFeatureSource struct {
mock.Mock
}
// Name provides a mock function with no input arguments
// and string as return value
func (_m *MockFeatureSource) Name() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// Discover provides a mock function with no input arguments
// and []string and error as the return values
func (_m *MockFeatureSource) Discover() (source.Features, error) {
ret := _m.Called()
var r0 source.Features
if rf, ok := ret.Get(0).(func() source.Features); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(source.Features)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}

View file

@ -0,0 +1,49 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Re-generate by running 'make mock'
package source
import mock "github.com/stretchr/testify/mock"
// MockFeatureSource is an autogenerated mock type for the FeatureSource type
type MockFeatureSource struct {
mock.Mock
}
// Discover provides a mock function with given fields:
func (_m *MockFeatureSource) Discover() (Features, error) {
ret := _m.Called()
var r0 Features
if rf, ok := ret.Get(0).(func() Features); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(Features)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Name provides a mock function with given fields:
func (_m *MockFeatureSource) Name() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}