From 8a67b3e16484746bc674c5025de94aba576da855 Mon Sep 17 00:00:00 2001 From: Enrique Llorente Date: Fri, 28 Jun 2024 12:23:36 +0200 Subject: [PATCH] test: Integrate mockery to Makefile Signed-off-by: Enrique Llorente --- go-controller/.mockery.yaml | 58 ++++++ go-controller/Makefile | 35 ++++ .../pkg/cni/mocks/CNIPluginLibOps.go | 26 ++- .../pkg/factory/mocks/ObjectCacheInterface.go | 97 +++++++++- go-controller/pkg/kube/mocks/Annotator.go | 2 +- go-controller/pkg/kube/mocks/HTTPServer.go | 2 +- .../pkg/kube/mocks/HTTPServerFactory.go | 2 +- go-controller/pkg/kube/mocks/Interface.go | 2 +- go-controller/pkg/kube/mocks/InterfaceOVN.go | 2 +- go-controller/pkg/kube/mocks/Listener.go | 2 +- go-controller/pkg/kube/mocks/Server.go | 2 +- .../pkg/ovn/address_set/mocks/AddressSet.go | 2 +- .../address_set/mocks/AddressSetFactory.go | 2 +- .../address_set/mocks/AddressSetIterFunc.go | 2 +- .../pkg/ovn/address_set/mocks/removeFunc.go | 2 +- .../cni/pkg/types/Result.go | 32 +++- .../plugins/pkg/ns/NetNS.go | 31 +++- .../v1/NetworkAttachmentDefinitionLister.go | 0 ...workAttachmentDefinitionNamespaceLister.go | 0 .../github.com/vishvananda/netlink/Link.go | 19 +- .../testing/mocks/k8s.io/utils/exec/Cmd.go | 59 +++++- .../mocks/k8s.io/utils/exec/ExitError.go | 27 ++- .../mocks/k8s.io/utils/exec/Interface.go | 28 ++- go-controller/pkg/util/mocks/DNSOps.go | 27 ++- go-controller/pkg/util/mocks/ExecRunner.go | 15 +- go-controller/pkg/util/mocks/FileSystemOps.go | 15 +- go-controller/pkg/util/mocks/NetLinkOps.go | 115 +++++++++++- go-controller/pkg/util/mocks/SriovnetOps.go | 173 +++++++++++++----- go-controller/pkg/util/mocks/VdpaDevice.go | 35 +++- go-controller/pkg/util/mocks/VdpaOps.go | 15 +- go-controller/pkg/util/util_unit_test.go | 2 +- 31 files changed, 675 insertions(+), 156 deletions(-) create mode 100644 go-controller/.mockery.yaml rename go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/{ => pkg/client}/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionLister.go (100%) rename go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/{ => pkg/client}/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionNamespaceLister.go (100%) diff --git a/go-controller/.mockery.yaml b/go-controller/.mockery.yaml new file mode 100644 index 00000000000..af8aef4660e --- /dev/null +++ b/go-controller/.mockery.yaml @@ -0,0 +1,58 @@ +dir: pkg/testing/mocks/{{.PackagePath}} +with-expecter: false +filename: "{{.InterfaceName}}.go" +mockname: "{{.InterfaceName}}" +outpkg: "mocks" +packages: + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/factory: + interfaces: + NodeWatchFactory: + ObjectCacheInterface: + config: + dir: pkg/factory/mocks/ + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cni: + interfaces: + CNIPluginLibOps: + NetNS: + config: + dir: pkg/cni/mocks + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/kube: + config: + all: true + dir: pkg/kube/mocks + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/kube/healthcheck: + config: + all: true + dir: pkg/kube/mocks + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/ovn/address_set: + config: + all: true + dir: pkg/ovn/address_set/mocks + github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util: + interfaces: + DNSOps: + ExecRunner: + FileSystemOps: + NetLinkOps: + SriovnetOps: + VdpaDevice: + VdpaOps: + config: + dir: pkg/util/mocks + k8s.io/utils/exec: + config: + all: true + github.com/vishvananda/netlink: + interfaces: + Link: + github.com/containernetworking/cni/pkg/types: + interfaces: + Result: + github.com/containernetworking/plugins/pkg/ns: + interfaces: + NetNS: + github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1: + interfaces: + NetworkAttachmentDefinitionLister: + NetworkAttachmentDefinitionNamespaceLister: + diff --git a/go-controller/Makefile b/go-controller/Makefile index 4e43dace005..139e4ae3b91 100644 --- a/go-controller/Makefile +++ b/go-controller/Makefile @@ -28,6 +28,14 @@ C_ARGS = -e NOROOT=TRUE else C_ARGS = --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --privileged endif + +## Tool Binaries +TOOLS_OUTPUT_DIR = ${CURDIR}/${OUT_DIR} +MOCKERY = ${TOOLS_OUTPUT_DIR}/mockery-${MOCKERY_VERSION} + +## Tool Versions +MOCKERY_VERSION ?= v2.43.2 + export NOROOT .PHONY: all build check test @@ -62,6 +70,10 @@ modelgen: pkg/nbdb/ovn-nb.ovsschema pkg/sbdb/ovn-sb.ovsschema codegen: hack/update-codegen.sh +.PHONY: mocksgen +mocksgen: ${MOCKERY} + ${MOCKERY} + install: install -D -m 755 ${OUT_DIR}/go/bin/ovnkube ${BINDIR}/ install -D -m 755 ${OUT_DIR}/go/bin/ovn-kube-util ${BINDIR}/ @@ -95,3 +107,26 @@ pkg/nbdb/ovn-nb.ovsschema: pkg/sbdb/ovn-sb.ovsschema: curl -sSL https://raw.githubusercontent.com/ovn-org/ovn/$(OVN_SCHEMA_VERSION)/ovn-sb.ovsschema -o $@ + +${TOOLS_OUTPUT_DIR}: + mkdir -p ${TOOLS_OUTPUT_DIR} + +.PHONY: mockery +mockery: ${MOCKERY} ## Download mockery locally if necessary. +${MOCKERY}: ${TOOLS_OUTPUT_DIR} + $(call go-install-tool,${MOCKERY},github.com/vektra/mockery/v2,${MOCKERY_VERSION}) + + +# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist +# $1 - target path with name of binary (ideally with version) +# $2 - package url which can be installed +# $3 - specific version of package +define go-install-tool +@[ -f $(1) ] || { \ +set -xe; \ +package=$(2)@$(3) ;\ +echo "Downloading $${package}" ;\ +GOBIN=${TOOLS_OUTPUT_DIR} go install $${package} ;\ +mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\ +} +endef diff --git a/go-controller/pkg/cni/mocks/CNIPluginLibOps.go b/go-controller/pkg/cni/mocks/CNIPluginLibOps.go index f67e807c78c..8ddbeb5fd08 100644 --- a/go-controller/pkg/cni/mocks/CNIPluginLibOps.go +++ b/go-controller/pkg/cni/mocks/CNIPluginLibOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -21,6 +21,10 @@ type CNIPluginLibOps struct { func (_m *CNIPluginLibOps) AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link, mtu int) error { ret := _m.Called(ipn, gw, dev, mtu) + if len(ret) == 0 { + panic("no return value specified for AddRoute") + } + var r0 error if rf, ok := ret.Get(0).(func(*net.IPNet, net.IP, netlink.Link, int) error); ok { r0 = rf(ipn, gw, dev, mtu) @@ -35,21 +39,28 @@ func (_m *CNIPluginLibOps) AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link, func (_m *CNIPluginLibOps) SetupVeth(contVethName string, hostVethName string, mtu int, contVethMac string, hostNS ns.NetNS) (net.Interface, net.Interface, error) { ret := _m.Called(contVethName, hostVethName, mtu, contVethMac, hostNS) + if len(ret) == 0 { + panic("no return value specified for SetupVeth") + } + var r0 net.Interface + var r1 net.Interface + var r2 error + if rf, ok := ret.Get(0).(func(string, string, int, string, ns.NetNS) (net.Interface, net.Interface, error)); ok { + return rf(contVethName, hostVethName, mtu, contVethMac, hostNS) + } if rf, ok := ret.Get(0).(func(string, string, int, string, ns.NetNS) net.Interface); ok { r0 = rf(contVethName, hostVethName, mtu, contVethMac, hostNS) } else { r0 = ret.Get(0).(net.Interface) } - var r1 net.Interface if rf, ok := ret.Get(1).(func(string, string, int, string, ns.NetNS) net.Interface); ok { r1 = rf(contVethName, hostVethName, mtu, contVethMac, hostNS) } else { r1 = ret.Get(1).(net.Interface) } - var r2 error if rf, ok := ret.Get(2).(func(string, string, int, string, ns.NetNS) error); ok { r2 = rf(contVethName, hostVethName, mtu, contVethMac, hostNS) } else { @@ -59,13 +70,12 @@ func (_m *CNIPluginLibOps) SetupVeth(contVethName string, hostVethName string, m return r0, r1, r2 } -type mockConstructorTestingTNewCNIPluginLibOps interface { +// NewCNIPluginLibOps creates a new instance of CNIPluginLibOps. 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 NewCNIPluginLibOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewCNIPluginLibOps creates a new instance of CNIPluginLibOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewCNIPluginLibOps(t mockConstructorTestingTNewCNIPluginLibOps) *CNIPluginLibOps { +}) *CNIPluginLibOps { mock := &CNIPluginLibOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/factory/mocks/ObjectCacheInterface.go b/go-controller/pkg/factory/mocks/ObjectCacheInterface.go index 08dec7edc4f..9ad55096830 100644 --- a/go-controller/pkg/factory/mocks/ObjectCacheInterface.go +++ b/go-controller/pkg/factory/mocks/ObjectCacheInterface.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -19,7 +19,15 @@ type ObjectCacheInterface struct { func (_m *ObjectCacheInterface) GetAllPods() ([]*v1.Pod, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetAllPods") + } + var r0 []*v1.Pod + var r1 error + if rf, ok := ret.Get(0).(func() ([]*v1.Pod, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []*v1.Pod); ok { r0 = rf() } else { @@ -28,7 +36,6 @@ func (_m *ObjectCacheInterface) GetAllPods() ([]*v1.Pod, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -42,7 +49,15 @@ func (_m *ObjectCacheInterface) GetAllPods() ([]*v1.Pod, error) { func (_m *ObjectCacheInterface) GetEndpointSlices(namespace string, svcName string) ([]*discoveryv1.EndpointSlice, error) { ret := _m.Called(namespace, svcName) + if len(ret) == 0 { + panic("no return value specified for GetEndpointSlices") + } + var r0 []*discoveryv1.EndpointSlice + var r1 error + if rf, ok := ret.Get(0).(func(string, string) ([]*discoveryv1.EndpointSlice, error)); ok { + return rf(namespace, svcName) + } if rf, ok := ret.Get(0).(func(string, string) []*discoveryv1.EndpointSlice); ok { r0 = rf(namespace, svcName) } else { @@ -51,7 +66,6 @@ func (_m *ObjectCacheInterface) GetEndpointSlices(namespace string, svcName stri } } - var r1 error if rf, ok := ret.Get(1).(func(string, string) error); ok { r1 = rf(namespace, svcName) } else { @@ -65,7 +79,15 @@ func (_m *ObjectCacheInterface) GetEndpointSlices(namespace string, svcName stri func (_m *ObjectCacheInterface) GetNamespace(name string) (*v1.Namespace, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetNamespace") + } + var r0 *v1.Namespace + var r1 error + if rf, ok := ret.Get(0).(func(string) (*v1.Namespace, error)); ok { + return rf(name) + } if rf, ok := ret.Get(0).(func(string) *v1.Namespace); ok { r0 = rf(name) } else { @@ -74,7 +96,6 @@ func (_m *ObjectCacheInterface) GetNamespace(name string) (*v1.Namespace, error) } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(name) } else { @@ -88,7 +109,15 @@ func (_m *ObjectCacheInterface) GetNamespace(name string) (*v1.Namespace, error) func (_m *ObjectCacheInterface) GetNamespaces() ([]*v1.Namespace, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetNamespaces") + } + var r0 []*v1.Namespace + var r1 error + if rf, ok := ret.Get(0).(func() ([]*v1.Namespace, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []*v1.Namespace); ok { r0 = rf() } else { @@ -97,7 +126,6 @@ func (_m *ObjectCacheInterface) GetNamespaces() ([]*v1.Namespace, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -111,7 +139,15 @@ func (_m *ObjectCacheInterface) GetNamespaces() ([]*v1.Namespace, error) { func (_m *ObjectCacheInterface) GetNode(name string) (*v1.Node, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetNode") + } + var r0 *v1.Node + var r1 error + if rf, ok := ret.Get(0).(func(string) (*v1.Node, error)); ok { + return rf(name) + } if rf, ok := ret.Get(0).(func(string) *v1.Node); ok { r0 = rf(name) } else { @@ -120,7 +156,6 @@ func (_m *ObjectCacheInterface) GetNode(name string) (*v1.Node, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(name) } else { @@ -134,7 +169,15 @@ func (_m *ObjectCacheInterface) GetNode(name string) (*v1.Node, error) { func (_m *ObjectCacheInterface) GetNodes() ([]*v1.Node, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetNodes") + } + var r0 []*v1.Node + var r1 error + if rf, ok := ret.Get(0).(func() ([]*v1.Node, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []*v1.Node); ok { r0 = rf() } else { @@ -143,7 +186,6 @@ func (_m *ObjectCacheInterface) GetNodes() ([]*v1.Node, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -157,7 +199,15 @@ func (_m *ObjectCacheInterface) GetNodes() ([]*v1.Node, error) { func (_m *ObjectCacheInterface) GetPod(namespace string, name string) (*v1.Pod, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for GetPod") + } + var r0 *v1.Pod + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*v1.Pod, error)); ok { + return rf(namespace, name) + } if rf, ok := ret.Get(0).(func(string, string) *v1.Pod); ok { r0 = rf(namespace, name) } else { @@ -166,7 +216,6 @@ func (_m *ObjectCacheInterface) GetPod(namespace string, name string) (*v1.Pod, } } - var r1 error if rf, ok := ret.Get(1).(func(string, string) error); ok { r1 = rf(namespace, name) } else { @@ -180,7 +229,15 @@ func (_m *ObjectCacheInterface) GetPod(namespace string, name string) (*v1.Pod, func (_m *ObjectCacheInterface) GetPods(namespace string) ([]*v1.Pod, error) { ret := _m.Called(namespace) + if len(ret) == 0 { + panic("no return value specified for GetPods") + } + var r0 []*v1.Pod + var r1 error + if rf, ok := ret.Get(0).(func(string) ([]*v1.Pod, error)); ok { + return rf(namespace) + } if rf, ok := ret.Get(0).(func(string) []*v1.Pod); ok { r0 = rf(namespace) } else { @@ -189,7 +246,6 @@ func (_m *ObjectCacheInterface) GetPods(namespace string) ([]*v1.Pod, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(namespace) } else { @@ -203,7 +259,15 @@ func (_m *ObjectCacheInterface) GetPods(namespace string) ([]*v1.Pod, error) { func (_m *ObjectCacheInterface) GetService(namespace string, name string) (*v1.Service, error) { ret := _m.Called(namespace, name) + if len(ret) == 0 { + panic("no return value specified for GetService") + } + var r0 *v1.Service + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*v1.Service, error)); ok { + return rf(namespace, name) + } if rf, ok := ret.Get(0).(func(string, string) *v1.Service); ok { r0 = rf(namespace, name) } else { @@ -212,7 +276,6 @@ func (_m *ObjectCacheInterface) GetService(namespace string, name string) (*v1.S } } - var r1 error if rf, ok := ret.Get(1).(func(string, string) error); ok { r1 = rf(namespace, name) } else { @@ -221,3 +284,17 @@ func (_m *ObjectCacheInterface) GetService(namespace string, name string) (*v1.S return r0, r1 } + +// NewObjectCacheInterface creates a new instance of ObjectCacheInterface. 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 NewObjectCacheInterface(t interface { + mock.TestingT + Cleanup(func()) +}) *ObjectCacheInterface { + mock := &ObjectCacheInterface{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/go-controller/pkg/kube/mocks/Annotator.go b/go-controller/pkg/kube/mocks/Annotator.go index 71fdd575e96..082d7c43fc9 100644 --- a/go-controller/pkg/kube/mocks/Annotator.go +++ b/go-controller/pkg/kube/mocks/Annotator.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/HTTPServer.go b/go-controller/pkg/kube/mocks/HTTPServer.go index 25be4cce7ce..56f2f9ff9f6 100644 --- a/go-controller/pkg/kube/mocks/HTTPServer.go +++ b/go-controller/pkg/kube/mocks/HTTPServer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/HTTPServerFactory.go b/go-controller/pkg/kube/mocks/HTTPServerFactory.go index 68c1e2a45d7..dfe42ae0b74 100644 --- a/go-controller/pkg/kube/mocks/HTTPServerFactory.go +++ b/go-controller/pkg/kube/mocks/HTTPServerFactory.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/Interface.go b/go-controller/pkg/kube/mocks/Interface.go index 33d557ce5dc..6631ca44c04 100644 --- a/go-controller/pkg/kube/mocks/Interface.go +++ b/go-controller/pkg/kube/mocks/Interface.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/InterfaceOVN.go b/go-controller/pkg/kube/mocks/InterfaceOVN.go index 138e0e9ad67..14a8a33af6a 100644 --- a/go-controller/pkg/kube/mocks/InterfaceOVN.go +++ b/go-controller/pkg/kube/mocks/InterfaceOVN.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/Listener.go b/go-controller/pkg/kube/mocks/Listener.go index 3982b4de2c1..dc8fda00743 100644 --- a/go-controller/pkg/kube/mocks/Listener.go +++ b/go-controller/pkg/kube/mocks/Listener.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/kube/mocks/Server.go b/go-controller/pkg/kube/mocks/Server.go index 54f543fa174..a91ea7cd899 100644 --- a/go-controller/pkg/kube/mocks/Server.go +++ b/go-controller/pkg/kube/mocks/Server.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/ovn/address_set/mocks/AddressSet.go b/go-controller/pkg/ovn/address_set/mocks/AddressSet.go index 9a0a25353a8..f8b9761b263 100644 --- a/go-controller/pkg/ovn/address_set/mocks/AddressSet.go +++ b/go-controller/pkg/ovn/address_set/mocks/AddressSet.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/ovn/address_set/mocks/AddressSetFactory.go b/go-controller/pkg/ovn/address_set/mocks/AddressSetFactory.go index 251e25f8aad..f76d6f132ad 100644 --- a/go-controller/pkg/ovn/address_set/mocks/AddressSetFactory.go +++ b/go-controller/pkg/ovn/address_set/mocks/AddressSetFactory.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/ovn/address_set/mocks/AddressSetIterFunc.go b/go-controller/pkg/ovn/address_set/mocks/AddressSetIterFunc.go index f8fb8795a99..1c9ff3de628 100644 --- a/go-controller/pkg/ovn/address_set/mocks/AddressSetIterFunc.go +++ b/go-controller/pkg/ovn/address_set/mocks/AddressSetIterFunc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/ovn/address_set/mocks/removeFunc.go b/go-controller/pkg/ovn/address_set/mocks/removeFunc.go index 679fc190751..044f4b440a0 100644 --- a/go-controller/pkg/ovn/address_set/mocks/removeFunc.go +++ b/go-controller/pkg/ovn/address_set/mocks/removeFunc.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks diff --git a/go-controller/pkg/testing/mocks/github.com/containernetworking/cni/pkg/types/Result.go b/go-controller/pkg/testing/mocks/github.com/containernetworking/cni/pkg/types/Result.go index 9fc6a0d2c7d..4fc1e8bd3a5 100644 --- a/go-controller/pkg/testing/mocks/github.com/containernetworking/cni/pkg/types/Result.go +++ b/go-controller/pkg/testing/mocks/github.com/containernetworking/cni/pkg/types/Result.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -18,7 +18,15 @@ type Result struct { func (_m *Result) GetAsVersion(version string) (types.Result, error) { ret := _m.Called(version) + if len(ret) == 0 { + panic("no return value specified for GetAsVersion") + } + var r0 types.Result + var r1 error + if rf, ok := ret.Get(0).(func(string) (types.Result, error)); ok { + return rf(version) + } if rf, ok := ret.Get(0).(func(string) types.Result); ok { r0 = rf(version) } else { @@ -27,7 +35,6 @@ func (_m *Result) GetAsVersion(version string) (types.Result, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(version) } else { @@ -41,6 +48,10 @@ func (_m *Result) GetAsVersion(version string) (types.Result, error) { func (_m *Result) Print() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Print") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -55,6 +66,10 @@ func (_m *Result) Print() error { func (_m *Result) PrintTo(writer io.Writer) error { ret := _m.Called(writer) + if len(ret) == 0 { + panic("no return value specified for PrintTo") + } + var r0 error if rf, ok := ret.Get(0).(func(io.Writer) error); ok { r0 = rf(writer) @@ -69,6 +84,10 @@ func (_m *Result) PrintTo(writer io.Writer) error { func (_m *Result) Version() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Version") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -79,13 +98,12 @@ func (_m *Result) Version() string { return r0 } -type mockConstructorTestingTNewResult interface { +// NewResult creates a new instance of Result. 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 NewResult(t interface { mock.TestingT Cleanup(func()) -} - -// NewResult creates a new instance of Result. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewResult(t mockConstructorTestingTNewResult) *Result { +}) *Result { mock := &Result{} mock.Mock.Test(t) diff --git a/go-controller/pkg/testing/mocks/github.com/containernetworking/plugins/pkg/ns/NetNS.go b/go-controller/pkg/testing/mocks/github.com/containernetworking/plugins/pkg/ns/NetNS.go index 193359080ba..db75f12abcb 100644 --- a/go-controller/pkg/testing/mocks/github.com/containernetworking/plugins/pkg/ns/NetNS.go +++ b/go-controller/pkg/testing/mocks/github.com/containernetworking/plugins/pkg/ns/NetNS.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,6 +16,10 @@ type NetNS struct { func (_m *NetNS) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -30,6 +34,10 @@ func (_m *NetNS) Close() error { func (_m *NetNS) Do(toRun func(ns.NetNS) error) error { ret := _m.Called(toRun) + if len(ret) == 0 { + panic("no return value specified for Do") + } + var r0 error if rf, ok := ret.Get(0).(func(func(ns.NetNS) error) error); ok { r0 = rf(toRun) @@ -44,6 +52,10 @@ func (_m *NetNS) Do(toRun func(ns.NetNS) error) error { func (_m *NetNS) Fd() uintptr { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Fd") + } + var r0 uintptr if rf, ok := ret.Get(0).(func() uintptr); ok { r0 = rf() @@ -58,6 +70,10 @@ func (_m *NetNS) Fd() uintptr { func (_m *NetNS) Path() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Path") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -72,6 +88,10 @@ func (_m *NetNS) Path() string { func (_m *NetNS) Set() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Set") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -82,13 +102,12 @@ func (_m *NetNS) Set() error { return r0 } -type mockConstructorTestingTNewNetNS interface { +// NewNetNS creates a new instance of NetNS. 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 NewNetNS(t interface { mock.TestingT Cleanup(func()) -} - -// NewNetNS creates a new instance of NetNS. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNetNS(t mockConstructorTestingTNewNetNS) *NetNS { +}) *NetNS { mock := &NetNS{} mock.Mock.Test(t) diff --git a/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionLister.go b/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionLister.go similarity index 100% rename from go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionLister.go rename to go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionLister.go diff --git a/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionNamespaceLister.go b/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionNamespaceLister.go similarity index 100% rename from go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionNamespaceLister.go rename to go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1/NetworkAttachmentDefinitionNamespaceLister.go diff --git a/go-controller/pkg/testing/mocks/github.com/vishvananda/netlink/Link.go b/go-controller/pkg/testing/mocks/github.com/vishvananda/netlink/Link.go index 356d1f88553..2ffa594664e 100644 --- a/go-controller/pkg/testing/mocks/github.com/vishvananda/netlink/Link.go +++ b/go-controller/pkg/testing/mocks/github.com/vishvananda/netlink/Link.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,6 +16,10 @@ type Link struct { func (_m *Link) Attrs() *netlink.LinkAttrs { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Attrs") + } + var r0 *netlink.LinkAttrs if rf, ok := ret.Get(0).(func() *netlink.LinkAttrs); ok { r0 = rf() @@ -32,6 +36,10 @@ func (_m *Link) Attrs() *netlink.LinkAttrs { func (_m *Link) Type() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Type") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -42,13 +50,12 @@ func (_m *Link) Type() string { return r0 } -type mockConstructorTestingTNewLink interface { +// NewLink creates a new instance of Link. 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 NewLink(t interface { mock.TestingT Cleanup(func()) -} - -// NewLink creates a new instance of Link. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewLink(t mockConstructorTestingTNewLink) *Link { +}) *Link { mock := &Link{} mock.Mock.Test(t) diff --git a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Cmd.go b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Cmd.go index 29d78b92dfa..4c1db920252 100644 --- a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Cmd.go +++ b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Cmd.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -17,7 +17,15 @@ type Cmd struct { func (_m *Cmd) CombinedOutput() ([]byte, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CombinedOutput") + } + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func() ([]byte, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() } else { @@ -26,7 +34,6 @@ func (_m *Cmd) CombinedOutput() ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -40,7 +47,15 @@ func (_m *Cmd) CombinedOutput() ([]byte, error) { func (_m *Cmd) Output() ([]byte, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Output") + } + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func() ([]byte, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() } else { @@ -49,7 +64,6 @@ func (_m *Cmd) Output() ([]byte, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -63,6 +77,10 @@ func (_m *Cmd) Output() ([]byte, error) { func (_m *Cmd) Run() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Run") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -102,6 +120,10 @@ func (_m *Cmd) SetStdout(out io.Writer) { func (_m *Cmd) Start() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -116,7 +138,15 @@ func (_m *Cmd) Start() error { func (_m *Cmd) StderrPipe() (io.ReadCloser, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for StderrPipe") + } + var r0 io.ReadCloser + var r1 error + if rf, ok := ret.Get(0).(func() (io.ReadCloser, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() io.ReadCloser); ok { r0 = rf() } else { @@ -125,7 +155,6 @@ func (_m *Cmd) StderrPipe() (io.ReadCloser, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -139,7 +168,15 @@ func (_m *Cmd) StderrPipe() (io.ReadCloser, error) { func (_m *Cmd) StdoutPipe() (io.ReadCloser, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for StdoutPipe") + } + var r0 io.ReadCloser + var r1 error + if rf, ok := ret.Get(0).(func() (io.ReadCloser, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() io.ReadCloser); ok { r0 = rf() } else { @@ -148,7 +185,6 @@ func (_m *Cmd) StdoutPipe() (io.ReadCloser, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -167,6 +203,10 @@ func (_m *Cmd) Stop() { func (_m *Cmd) Wait() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Wait") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -177,13 +217,12 @@ func (_m *Cmd) Wait() error { return r0 } -type mockConstructorTestingTNewCmd interface { +// NewCmd creates a new instance of Cmd. 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 NewCmd(t interface { mock.TestingT Cleanup(func()) -} - -// NewCmd creates a new instance of Cmd. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewCmd(t mockConstructorTestingTNewCmd) *Cmd { +}) *Cmd { mock := &Cmd{} mock.Mock.Test(t) diff --git a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/ExitError.go b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/ExitError.go index a97f90eb7dd..1acd93ed117 100644 --- a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/ExitError.go +++ b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/ExitError.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type ExitError struct { func (_m *ExitError) Error() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Error") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -27,6 +31,10 @@ func (_m *ExitError) Error() string { func (_m *ExitError) ExitStatus() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ExitStatus") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -41,6 +49,10 @@ func (_m *ExitError) ExitStatus() int { func (_m *ExitError) Exited() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Exited") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -55,6 +67,10 @@ func (_m *ExitError) Exited() bool { func (_m *ExitError) String() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for String") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -65,13 +81,12 @@ func (_m *ExitError) String() string { return r0 } -type mockConstructorTestingTNewExitError interface { +// NewExitError creates a new instance of ExitError. 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 NewExitError(t interface { mock.TestingT Cleanup(func()) -} - -// NewExitError creates a new instance of ExitError. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewExitError(t mockConstructorTestingTNewExitError) *ExitError { +}) *ExitError { mock := &ExitError{} mock.Mock.Test(t) diff --git a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Interface.go b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Interface.go index b7f05161da5..0b4b0a8f9cd 100644 --- a/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Interface.go +++ b/go-controller/pkg/testing/mocks/k8s.io/utils/exec/Interface.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -26,6 +26,10 @@ func (_m *Interface) Command(cmd string, args ...string) exec.Cmd { _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Command") + } + var r0 exec.Cmd if rf, ok := ret.Get(0).(func(string, ...string) exec.Cmd); ok { r0 = rf(cmd, args...) @@ -49,6 +53,10 @@ func (_m *Interface) CommandContext(ctx context.Context, cmd string, args ...str _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for CommandContext") + } + var r0 exec.Cmd if rf, ok := ret.Get(0).(func(context.Context, string, ...string) exec.Cmd); ok { r0 = rf(ctx, cmd, args...) @@ -65,14 +73,21 @@ func (_m *Interface) CommandContext(ctx context.Context, cmd string, args ...str func (_m *Interface) LookPath(file string) (string, error) { ret := _m.Called(file) + if len(ret) == 0 { + panic("no return value specified for LookPath") + } + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(string) (string, error)); ok { + return rf(file) + } if rf, ok := ret.Get(0).(func(string) string); ok { r0 = rf(file) } else { r0 = ret.Get(0).(string) } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(file) } else { @@ -82,13 +97,12 @@ func (_m *Interface) LookPath(file string) (string, error) { return r0, r1 } -type mockConstructorTestingTNewInterface interface { +// NewInterface creates a new instance of Interface. 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 NewInterface(t interface { mock.TestingT Cleanup(func()) -} - -// NewInterface creates a new instance of Interface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewInterface(t mockConstructorTestingTNewInterface) *Interface { +}) *Interface { mock := &Interface{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/DNSOps.go b/go-controller/pkg/util/mocks/DNSOps.go index 32ceed47544..1ca8487d09e 100644 --- a/go-controller/pkg/util/mocks/DNSOps.go +++ b/go-controller/pkg/util/mocks/DNSOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type DNSOps struct { func (_m *DNSOps) ClientConfigFromFile(resolvconf string) (*dns.ClientConfig, error) { ret := _m.Called(resolvconf) + if len(ret) == 0 { + panic("no return value specified for ClientConfigFromFile") + } + var r0 *dns.ClientConfig var r1 error if rf, ok := ret.Get(0).(func(string) (*dns.ClientConfig, error)); ok { @@ -44,6 +48,10 @@ func (_m *DNSOps) ClientConfigFromFile(resolvconf string) (*dns.ClientConfig, er func (_m *DNSOps) Exchange(c *dns.Client, m *dns.Msg, a string) (*dns.Msg, time.Duration, error) { ret := _m.Called(c, m, a) + if len(ret) == 0 { + panic("no return value specified for Exchange") + } + var r0 *dns.Msg var r1 time.Duration var r2 error @@ -77,6 +85,10 @@ func (_m *DNSOps) Exchange(c *dns.Client, m *dns.Msg, a string) (*dns.Msg, time. func (_m *DNSOps) Fqdn(s string) string { ret := _m.Called(s) + if len(ret) == 0 { + panic("no return value specified for Fqdn") + } + var r0 string if rf, ok := ret.Get(0).(func(string) string); ok { r0 = rf(s) @@ -91,6 +103,10 @@ func (_m *DNSOps) Fqdn(s string) string { func (_m *DNSOps) SetQuestion(msg *dns.Msg, z string, t uint16) *dns.Msg { ret := _m.Called(msg, z, t) + if len(ret) == 0 { + panic("no return value specified for SetQuestion") + } + var r0 *dns.Msg if rf, ok := ret.Get(0).(func(*dns.Msg, string, uint16) *dns.Msg); ok { r0 = rf(msg, z, t) @@ -103,13 +119,12 @@ func (_m *DNSOps) SetQuestion(msg *dns.Msg, z string, t uint16) *dns.Msg { return r0 } -type mockConstructorTestingTNewDNSOps interface { +// NewDNSOps creates a new instance of DNSOps. 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 NewDNSOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewDNSOps creates a new instance of DNSOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDNSOps(t mockConstructorTestingTNewDNSOps) *DNSOps { +}) *DNSOps { mock := &DNSOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/ExecRunner.go b/go-controller/pkg/util/mocks/ExecRunner.go index 55b57b04245..88afca41804 100644 --- a/go-controller/pkg/util/mocks/ExecRunner.go +++ b/go-controller/pkg/util/mocks/ExecRunner.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -26,6 +26,10 @@ func (_m *ExecRunner) RunCmd(cmd exec.Cmd, cmdPath string, envVars []string, arg _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for RunCmd") + } + var r0 *bytes.Buffer var r1 *bytes.Buffer var r2 error @@ -57,13 +61,12 @@ func (_m *ExecRunner) RunCmd(cmd exec.Cmd, cmdPath string, envVars []string, arg return r0, r1, r2 } -type mockConstructorTestingTNewExecRunner interface { +// NewExecRunner creates a new instance of ExecRunner. 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 NewExecRunner(t interface { mock.TestingT Cleanup(func()) -} - -// NewExecRunner creates a new instance of ExecRunner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewExecRunner(t mockConstructorTestingTNewExecRunner) *ExecRunner { +}) *ExecRunner { mock := &ExecRunner{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/FileSystemOps.go b/go-controller/pkg/util/mocks/FileSystemOps.go index 01ab49a7c73..c7c8bdbcb8f 100644 --- a/go-controller/pkg/util/mocks/FileSystemOps.go +++ b/go-controller/pkg/util/mocks/FileSystemOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -13,6 +13,10 @@ type FileSystemOps struct { func (_m *FileSystemOps) Readlink(path string) (string, error) { ret := _m.Called(path) + if len(ret) == 0 { + panic("no return value specified for Readlink") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -33,13 +37,12 @@ func (_m *FileSystemOps) Readlink(path string) (string, error) { return r0, r1 } -type mockConstructorTestingTNewFileSystemOps interface { +// NewFileSystemOps creates a new instance of FileSystemOps. 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 NewFileSystemOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewFileSystemOps creates a new instance of FileSystemOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFileSystemOps(t mockConstructorTestingTNewFileSystemOps) *FileSystemOps { +}) *FileSystemOps { mock := &FileSystemOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/NetLinkOps.go b/go-controller/pkg/util/mocks/NetLinkOps.go index 85c146202a6..7ad8719d98f 100644 --- a/go-controller/pkg/util/mocks/NetLinkOps.go +++ b/go-controller/pkg/util/mocks/NetLinkOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -19,6 +19,10 @@ type NetLinkOps struct { func (_m *NetLinkOps) AddrAdd(link netlink.Link, addr *netlink.Addr) error { ret := _m.Called(link, addr) + if len(ret) == 0 { + panic("no return value specified for AddrAdd") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, *netlink.Addr) error); ok { r0 = rf(link, addr) @@ -33,6 +37,10 @@ func (_m *NetLinkOps) AddrAdd(link netlink.Link, addr *netlink.Addr) error { func (_m *NetLinkOps) AddrDel(link netlink.Link, addr *netlink.Addr) error { ret := _m.Called(link, addr) + if len(ret) == 0 { + panic("no return value specified for AddrDel") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, *netlink.Addr) error); ok { r0 = rf(link, addr) @@ -47,6 +55,10 @@ func (_m *NetLinkOps) AddrDel(link netlink.Link, addr *netlink.Addr) error { func (_m *NetLinkOps) AddrList(link netlink.Link, family int) ([]netlink.Addr, error) { ret := _m.Called(link, family) + if len(ret) == 0 { + panic("no return value specified for AddrList") + } + var r0 []netlink.Addr var r1 error if rf, ok := ret.Get(0).(func(netlink.Link, int) ([]netlink.Addr, error)); ok { @@ -73,6 +85,10 @@ func (_m *NetLinkOps) AddrList(link netlink.Link, family int) ([]netlink.Addr, e func (_m *NetLinkOps) ConntrackDeleteFilter(table netlink.ConntrackTableType, family netlink.InetFamily, filter netlink.CustomConntrackFilter) (uint, error) { ret := _m.Called(table, family, filter) + if len(ret) == 0 { + panic("no return value specified for ConntrackDeleteFilter") + } + var r0 uint var r1 error if rf, ok := ret.Get(0).(func(netlink.ConntrackTableType, netlink.InetFamily, netlink.CustomConntrackFilter) (uint, error)); ok { @@ -97,6 +113,10 @@ func (_m *NetLinkOps) ConntrackDeleteFilter(table netlink.ConntrackTableType, fa func (_m *NetLinkOps) IsLinkNotFoundError(err error) bool { ret := _m.Called(err) + if len(ret) == 0 { + panic("no return value specified for IsLinkNotFoundError") + } + var r0 bool if rf, ok := ret.Get(0).(func(error) bool); ok { r0 = rf(err) @@ -111,6 +131,10 @@ func (_m *NetLinkOps) IsLinkNotFoundError(err error) bool { func (_m *NetLinkOps) LinkByIndex(index int) (netlink.Link, error) { ret := _m.Called(index) + if len(ret) == 0 { + panic("no return value specified for LinkByIndex") + } + var r0 netlink.Link var r1 error if rf, ok := ret.Get(0).(func(int) (netlink.Link, error)); ok { @@ -137,6 +161,10 @@ func (_m *NetLinkOps) LinkByIndex(index int) (netlink.Link, error) { func (_m *NetLinkOps) LinkByName(ifaceName string) (netlink.Link, error) { ret := _m.Called(ifaceName) + if len(ret) == 0 { + panic("no return value specified for LinkByName") + } + var r0 netlink.Link var r1 error if rf, ok := ret.Get(0).(func(string) (netlink.Link, error)); ok { @@ -163,6 +191,10 @@ func (_m *NetLinkOps) LinkByName(ifaceName string) (netlink.Link, error) { func (_m *NetLinkOps) LinkDelete(link netlink.Link) error { ret := _m.Called(link) + if len(ret) == 0 { + panic("no return value specified for LinkDelete") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link) error); ok { r0 = rf(link) @@ -177,6 +209,10 @@ func (_m *NetLinkOps) LinkDelete(link netlink.Link) error { func (_m *NetLinkOps) LinkList() ([]netlink.Link, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LinkList") + } + var r0 []netlink.Link var r1 error if rf, ok := ret.Get(0).(func() ([]netlink.Link, error)); ok { @@ -203,6 +239,10 @@ func (_m *NetLinkOps) LinkList() ([]netlink.Link, error) { func (_m *NetLinkOps) LinkSetDown(link netlink.Link) error { ret := _m.Called(link) + if len(ret) == 0 { + panic("no return value specified for LinkSetDown") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link) error); ok { r0 = rf(link) @@ -217,6 +257,10 @@ func (_m *NetLinkOps) LinkSetDown(link netlink.Link) error { func (_m *NetLinkOps) LinkSetHardwareAddr(link netlink.Link, hwaddr net.HardwareAddr) error { ret := _m.Called(link, hwaddr) + if len(ret) == 0 { + panic("no return value specified for LinkSetHardwareAddr") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, net.HardwareAddr) error); ok { r0 = rf(link, hwaddr) @@ -231,6 +275,10 @@ func (_m *NetLinkOps) LinkSetHardwareAddr(link netlink.Link, hwaddr net.Hardware func (_m *NetLinkOps) LinkSetMTU(link netlink.Link, mtu int) error { ret := _m.Called(link, mtu) + if len(ret) == 0 { + panic("no return value specified for LinkSetMTU") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, int) error); ok { r0 = rf(link, mtu) @@ -245,6 +293,10 @@ func (_m *NetLinkOps) LinkSetMTU(link netlink.Link, mtu int) error { func (_m *NetLinkOps) LinkSetName(link netlink.Link, newName string) error { ret := _m.Called(link, newName) + if len(ret) == 0 { + panic("no return value specified for LinkSetName") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, string) error); ok { r0 = rf(link, newName) @@ -259,6 +311,10 @@ func (_m *NetLinkOps) LinkSetName(link netlink.Link, newName string) error { func (_m *NetLinkOps) LinkSetNsFd(link netlink.Link, fd int) error { ret := _m.Called(link, fd) + if len(ret) == 0 { + panic("no return value specified for LinkSetNsFd") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, int) error); ok { r0 = rf(link, fd) @@ -273,6 +329,10 @@ func (_m *NetLinkOps) LinkSetNsFd(link netlink.Link, fd int) error { func (_m *NetLinkOps) LinkSetTxQLen(link netlink.Link, qlen int) error { ret := _m.Called(link, qlen) + if len(ret) == 0 { + panic("no return value specified for LinkSetTxQLen") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, int) error); ok { r0 = rf(link, qlen) @@ -287,6 +347,10 @@ func (_m *NetLinkOps) LinkSetTxQLen(link netlink.Link, qlen int) error { func (_m *NetLinkOps) LinkSetUp(link netlink.Link) error { ret := _m.Called(link) + if len(ret) == 0 { + panic("no return value specified for LinkSetUp") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link) error); ok { r0 = rf(link) @@ -301,6 +365,10 @@ func (_m *NetLinkOps) LinkSetUp(link netlink.Link) error { func (_m *NetLinkOps) LinkSetVfHardwareAddr(pfLink netlink.Link, vfIndex int, hwaddr net.HardwareAddr) error { ret := _m.Called(pfLink, vfIndex, hwaddr) + if len(ret) == 0 { + panic("no return value specified for LinkSetVfHardwareAddr") + } + var r0 error if rf, ok := ret.Get(0).(func(netlink.Link, int, net.HardwareAddr) error); ok { r0 = rf(pfLink, vfIndex, hwaddr) @@ -315,6 +383,10 @@ func (_m *NetLinkOps) LinkSetVfHardwareAddr(pfLink netlink.Link, vfIndex int, hw func (_m *NetLinkOps) NeighAdd(neigh *netlink.Neigh) error { ret := _m.Called(neigh) + if len(ret) == 0 { + panic("no return value specified for NeighAdd") + } + var r0 error if rf, ok := ret.Get(0).(func(*netlink.Neigh) error); ok { r0 = rf(neigh) @@ -329,6 +401,10 @@ func (_m *NetLinkOps) NeighAdd(neigh *netlink.Neigh) error { func (_m *NetLinkOps) NeighDel(neigh *netlink.Neigh) error { ret := _m.Called(neigh) + if len(ret) == 0 { + panic("no return value specified for NeighDel") + } + var r0 error if rf, ok := ret.Get(0).(func(*netlink.Neigh) error); ok { r0 = rf(neigh) @@ -343,6 +419,10 @@ func (_m *NetLinkOps) NeighDel(neigh *netlink.Neigh) error { func (_m *NetLinkOps) NeighList(linkIndex int, family int) ([]netlink.Neigh, error) { ret := _m.Called(linkIndex, family) + if len(ret) == 0 { + panic("no return value specified for NeighList") + } + var r0 []netlink.Neigh var r1 error if rf, ok := ret.Get(0).(func(int, int) ([]netlink.Neigh, error)); ok { @@ -369,6 +449,10 @@ func (_m *NetLinkOps) NeighList(linkIndex int, family int) ([]netlink.Neigh, err func (_m *NetLinkOps) RouteAdd(route *netlink.Route) error { ret := _m.Called(route) + if len(ret) == 0 { + panic("no return value specified for RouteAdd") + } + var r0 error if rf, ok := ret.Get(0).(func(*netlink.Route) error); ok { r0 = rf(route) @@ -383,6 +467,10 @@ func (_m *NetLinkOps) RouteAdd(route *netlink.Route) error { func (_m *NetLinkOps) RouteDel(route *netlink.Route) error { ret := _m.Called(route) + if len(ret) == 0 { + panic("no return value specified for RouteDel") + } + var r0 error if rf, ok := ret.Get(0).(func(*netlink.Route) error); ok { r0 = rf(route) @@ -397,6 +485,10 @@ func (_m *NetLinkOps) RouteDel(route *netlink.Route) error { func (_m *NetLinkOps) RouteList(link netlink.Link, family int) ([]netlink.Route, error) { ret := _m.Called(link, family) + if len(ret) == 0 { + panic("no return value specified for RouteList") + } + var r0 []netlink.Route var r1 error if rf, ok := ret.Get(0).(func(netlink.Link, int) ([]netlink.Route, error)); ok { @@ -423,6 +515,10 @@ func (_m *NetLinkOps) RouteList(link netlink.Link, family int) ([]netlink.Route, func (_m *NetLinkOps) RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error) { ret := _m.Called(family, filter, filterMask) + if len(ret) == 0 { + panic("no return value specified for RouteListFiltered") + } + var r0 []netlink.Route var r1 error if rf, ok := ret.Get(0).(func(int, *netlink.Route, uint64) ([]netlink.Route, error)); ok { @@ -449,6 +545,10 @@ func (_m *NetLinkOps) RouteListFiltered(family int, filter *netlink.Route, filte func (_m *NetLinkOps) RouteReplace(route *netlink.Route) error { ret := _m.Called(route) + if len(ret) == 0 { + panic("no return value specified for RouteReplace") + } + var r0 error if rf, ok := ret.Get(0).(func(*netlink.Route) error); ok { r0 = rf(route) @@ -463,6 +563,10 @@ func (_m *NetLinkOps) RouteReplace(route *netlink.Route) error { func (_m *NetLinkOps) RuleListFiltered(family int, filter *netlink.Rule, filterMask uint64) ([]netlink.Rule, error) { ret := _m.Called(family, filter, filterMask) + if len(ret) == 0 { + panic("no return value specified for RuleListFiltered") + } + var r0 []netlink.Rule var r1 error if rf, ok := ret.Get(0).(func(int, *netlink.Rule, uint64) ([]netlink.Rule, error)); ok { @@ -485,13 +589,12 @@ func (_m *NetLinkOps) RuleListFiltered(family int, filter *netlink.Rule, filterM return r0, r1 } -type mockConstructorTestingTNewNetLinkOps interface { +// NewNetLinkOps creates a new instance of NetLinkOps. 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 NewNetLinkOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewNetLinkOps creates a new instance of NetLinkOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNetLinkOps(t mockConstructorTestingTNewNetLinkOps) *NetLinkOps { +}) *NetLinkOps { mock := &NetLinkOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/SriovnetOps.go b/go-controller/pkg/util/mocks/SriovnetOps.go index 8685049088e..ea6f4560b35 100644 --- a/go-controller/pkg/util/mocks/SriovnetOps.go +++ b/go-controller/pkg/util/mocks/SriovnetOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -15,52 +15,14 @@ type SriovnetOps struct { mock.Mock } -// GetPciFromNetDevice provides a mock function with given fields: name -func (_m *SriovnetOps) GetPciFromNetDevice(name string) (string, error) { - ret := _m.Called(name) - - var r0 string - if rf, ok := ret.Get(0).(func(string) string); ok { - r0 = rf(name) - } else { - r0 = ret.Get(0).(string) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetPortIndexFromRepresentor provides a mock function with given fields: name -func (_m *SriovnetOps) GetPortIndexFromRepresentor(name string) (int, error) { - ret := _m.Called(name) - - var r0 int - if rf, ok := ret.Get(0).(func(string) int); ok { - r0 = rf(name) - } else { - r0 = ret.Get(0).(int) - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(name) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // GetNetDevicesFromAux provides a mock function with given fields: auxDev func (_m *SriovnetOps) GetNetDevicesFromAux(auxDev string) ([]string, error) { ret := _m.Called(auxDev) + if len(ret) == 0 { + panic("no return value specified for GetNetDevicesFromAux") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok { @@ -87,6 +49,10 @@ func (_m *SriovnetOps) GetNetDevicesFromAux(auxDev string) ([]string, error) { func (_m *SriovnetOps) GetNetDevicesFromPci(pciAddress string) ([]string, error) { ret := _m.Called(pciAddress) + if len(ret) == 0 { + panic("no return value specified for GetNetDevicesFromPci") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok { @@ -113,6 +79,10 @@ func (_m *SriovnetOps) GetNetDevicesFromPci(pciAddress string) ([]string, error) func (_m *SriovnetOps) GetPCIFromDeviceName(netdevName string) (string, error) { ret := _m.Called(netdevName) + if len(ret) == 0 { + panic("no return value specified for GetPCIFromDeviceName") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -133,10 +103,42 @@ func (_m *SriovnetOps) GetPCIFromDeviceName(netdevName string) (string, error) { return r0, r1 } +// GetPciFromNetDevice provides a mock function with given fields: name +func (_m *SriovnetOps) GetPciFromNetDevice(name string) (string, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetPciFromNetDevice") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(string) (string, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) string); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetPfIndexByVfPciAddress provides a mock function with given fields: vfPciAddress func (_m *SriovnetOps) GetPfIndexByVfPciAddress(vfPciAddress string) (int, error) { ret := _m.Called(vfPciAddress) + if len(ret) == 0 { + panic("no return value specified for GetPfIndexByVfPciAddress") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func(string) (int, error)); ok { @@ -161,6 +163,10 @@ func (_m *SriovnetOps) GetPfIndexByVfPciAddress(vfPciAddress string) (int, error func (_m *SriovnetOps) GetPfPciFromAux(auxDev string) (string, error) { ret := _m.Called(auxDev) + if len(ret) == 0 { + panic("no return value specified for GetPfPciFromAux") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -185,6 +191,10 @@ func (_m *SriovnetOps) GetPfPciFromAux(auxDev string) (string, error) { func (_m *SriovnetOps) GetPfPciFromVfPci(vfPciAddress string) (string, error) { ret := _m.Called(vfPciAddress) + if len(ret) == 0 { + panic("no return value specified for GetPfPciFromVfPci") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -205,10 +215,42 @@ func (_m *SriovnetOps) GetPfPciFromVfPci(vfPciAddress string) (string, error) { return r0, r1 } +// GetPortIndexFromRepresentor provides a mock function with given fields: name +func (_m *SriovnetOps) GetPortIndexFromRepresentor(name string) (int, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetPortIndexFromRepresentor") + } + + var r0 int + var r1 error + if rf, ok := ret.Get(0).(func(string) (int, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) int); ok { + r0 = rf(name) + } else { + r0 = ret.Get(0).(int) + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // GetRepresentorPeerMacAddress provides a mock function with given fields: netdev func (_m *SriovnetOps) GetRepresentorPeerMacAddress(netdev string) (net.HardwareAddr, error) { ret := _m.Called(netdev) + if len(ret) == 0 { + panic("no return value specified for GetRepresentorPeerMacAddress") + } + var r0 net.HardwareAddr var r1 error if rf, ok := ret.Get(0).(func(string) (net.HardwareAddr, error)); ok { @@ -235,6 +277,10 @@ func (_m *SriovnetOps) GetRepresentorPeerMacAddress(netdev string) (net.Hardware func (_m *SriovnetOps) GetRepresentorPortFlavour(netdev string) (sriovnet.PortFlavour, error) { ret := _m.Called(netdev) + if len(ret) == 0 { + panic("no return value specified for GetRepresentorPortFlavour") + } + var r0 sriovnet.PortFlavour var r1 error if rf, ok := ret.Get(0).(func(string) (sriovnet.PortFlavour, error)); ok { @@ -259,6 +305,10 @@ func (_m *SriovnetOps) GetRepresentorPortFlavour(netdev string) (sriovnet.PortFl func (_m *SriovnetOps) GetSfIndexByAuxDev(auxDev string) (int, error) { ret := _m.Called(auxDev) + if len(ret) == 0 { + panic("no return value specified for GetSfIndexByAuxDev") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func(string) (int, error)); ok { @@ -283,6 +333,10 @@ func (_m *SriovnetOps) GetSfIndexByAuxDev(auxDev string) (int, error) { func (_m *SriovnetOps) GetSfRepresentor(uplink string, sfIndex int) (string, error) { ret := _m.Called(uplink, sfIndex) + if len(ret) == 0 { + panic("no return value specified for GetSfRepresentor") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, int) (string, error)); ok { @@ -307,6 +361,10 @@ func (_m *SriovnetOps) GetSfRepresentor(uplink string, sfIndex int) (string, err func (_m *SriovnetOps) GetUplinkRepresentor(vfPciAddress string) (string, error) { ret := _m.Called(vfPciAddress) + if len(ret) == 0 { + panic("no return value specified for GetUplinkRepresentor") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -331,6 +389,10 @@ func (_m *SriovnetOps) GetUplinkRepresentor(vfPciAddress string) (string, error) func (_m *SriovnetOps) GetUplinkRepresentorFromAux(auxDev string) (string, error) { ret := _m.Called(auxDev) + if len(ret) == 0 { + panic("no return value specified for GetUplinkRepresentorFromAux") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string) (string, error)); ok { @@ -355,6 +417,10 @@ func (_m *SriovnetOps) GetUplinkRepresentorFromAux(auxDev string) (string, error func (_m *SriovnetOps) GetVfIndexByPciAddress(vfPciAddress string) (int, error) { ret := _m.Called(vfPciAddress) + if len(ret) == 0 { + panic("no return value specified for GetVfIndexByPciAddress") + } + var r0 int var r1 error if rf, ok := ret.Get(0).(func(string) (int, error)); ok { @@ -379,6 +445,10 @@ func (_m *SriovnetOps) GetVfIndexByPciAddress(vfPciAddress string) (int, error) func (_m *SriovnetOps) GetVfRepresentor(uplink string, vfIndex int) (string, error) { ret := _m.Called(uplink, vfIndex) + if len(ret) == 0 { + panic("no return value specified for GetVfRepresentor") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, int) (string, error)); ok { @@ -403,6 +473,10 @@ func (_m *SriovnetOps) GetVfRepresentor(uplink string, vfIndex int) (string, err func (_m *SriovnetOps) GetVfRepresentorDPU(pfID string, vfIndex string) (string, error) { ret := _m.Called(pfID, vfIndex) + if len(ret) == 0 { + panic("no return value specified for GetVfRepresentorDPU") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok { @@ -427,6 +501,10 @@ func (_m *SriovnetOps) GetVfRepresentorDPU(pfID string, vfIndex string) (string, func (_m *SriovnetOps) IsVfPciVfioBound(pciAddr string) bool { ret := _m.Called(pciAddr) + if len(ret) == 0 { + panic("no return value specified for IsVfPciVfioBound") + } + var r0 bool if rf, ok := ret.Get(0).(func(string) bool); ok { r0 = rf(pciAddr) @@ -437,13 +515,12 @@ func (_m *SriovnetOps) IsVfPciVfioBound(pciAddr string) bool { return r0 } -type mockConstructorTestingTNewSriovnetOps interface { +// NewSriovnetOps creates a new instance of SriovnetOps. 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 NewSriovnetOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewSriovnetOps creates a new instance of SriovnetOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSriovnetOps(t mockConstructorTestingTNewSriovnetOps) *SriovnetOps { +}) *SriovnetOps { mock := &SriovnetOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/VdpaDevice.go b/go-controller/pkg/util/mocks/VdpaDevice.go index d980c7c81ab..f3b21787dfb 100644 --- a/go-controller/pkg/util/mocks/VdpaDevice.go +++ b/go-controller/pkg/util/mocks/VdpaDevice.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,6 +16,10 @@ type VdpaDevice struct { func (_m *VdpaDevice) Driver() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Driver") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -30,6 +34,10 @@ func (_m *VdpaDevice) Driver() string { func (_m *VdpaDevice) MgmtDev() kvdpa.MgmtDev { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for MgmtDev") + } + var r0 kvdpa.MgmtDev if rf, ok := ret.Get(0).(func() kvdpa.MgmtDev); ok { r0 = rf() @@ -46,6 +54,10 @@ func (_m *VdpaDevice) MgmtDev() kvdpa.MgmtDev { func (_m *VdpaDevice) Name() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Name") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -60,6 +72,10 @@ func (_m *VdpaDevice) Name() string { func (_m *VdpaDevice) ParentDevicePath() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ParentDevicePath") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -84,6 +100,10 @@ func (_m *VdpaDevice) ParentDevicePath() (string, error) { func (_m *VdpaDevice) VhostVdpa() kvdpa.VhostVdpa { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for VhostVdpa") + } + var r0 kvdpa.VhostVdpa if rf, ok := ret.Get(0).(func() kvdpa.VhostVdpa); ok { r0 = rf() @@ -100,6 +120,10 @@ func (_m *VdpaDevice) VhostVdpa() kvdpa.VhostVdpa { func (_m *VdpaDevice) VirtioNet() kvdpa.VirtioNet { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for VirtioNet") + } + var r0 kvdpa.VirtioNet if rf, ok := ret.Get(0).(func() kvdpa.VirtioNet); ok { r0 = rf() @@ -112,13 +136,12 @@ func (_m *VdpaDevice) VirtioNet() kvdpa.VirtioNet { return r0 } -type mockConstructorTestingTNewVdpaDevice interface { +// NewVdpaDevice creates a new instance of VdpaDevice. 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 NewVdpaDevice(t interface { mock.TestingT Cleanup(func()) -} - -// NewVdpaDevice creates a new instance of VdpaDevice. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewVdpaDevice(t mockConstructorTestingTNewVdpaDevice) *VdpaDevice { +}) *VdpaDevice { mock := &VdpaDevice{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/mocks/VdpaOps.go b/go-controller/pkg/util/mocks/VdpaOps.go index ca03d6ab2cb..7f82bb51831 100644 --- a/go-controller/pkg/util/mocks/VdpaOps.go +++ b/go-controller/pkg/util/mocks/VdpaOps.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.2. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,6 +16,10 @@ type VdpaOps struct { func (_m *VdpaOps) GetVdpaDeviceByPci(pciAddress string) (kvdpa.VdpaDevice, error) { ret := _m.Called(pciAddress) + if len(ret) == 0 { + panic("no return value specified for GetVdpaDeviceByPci") + } + var r0 kvdpa.VdpaDevice var r1 error if rf, ok := ret.Get(0).(func(string) (kvdpa.VdpaDevice, error)); ok { @@ -38,13 +42,12 @@ func (_m *VdpaOps) GetVdpaDeviceByPci(pciAddress string) (kvdpa.VdpaDevice, erro return r0, r1 } -type mockConstructorTestingTNewVdpaOps interface { +// NewVdpaOps creates a new instance of VdpaOps. 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 NewVdpaOps(t interface { mock.TestingT Cleanup(func()) -} - -// NewVdpaOps creates a new instance of VdpaOps. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewVdpaOps(t mockConstructorTestingTNewVdpaOps) *VdpaOps { +}) *VdpaOps { mock := &VdpaOps{} mock.Mock.Test(t) diff --git a/go-controller/pkg/util/util_unit_test.go b/go-controller/pkg/util/util_unit_test.go index da537643851..ff9ba8ee7dc 100644 --- a/go-controller/pkg/util/util_unit_test.go +++ b/go-controller/pkg/util/util_unit_test.go @@ -14,7 +14,7 @@ import ( "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" "k8s.io/apimachinery/pkg/labels" - v1nadmocks "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/listers/k8s.cni.cncf.io/v1" + v1nadmocks "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/testing/mocks/github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/listers/k8s.cni.cncf.io/v1" mock_k8s_io_utils_exec "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/testing/mocks/k8s.io/utils/exec" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util/mocks" "github.com/stretchr/testify/assert"