mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-04-01 14:28:48 +02:00
Closes #18929 Helps with #18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
306 lines
7.8 KiB
Go
Generated
306 lines
7.8 KiB
Go
Generated
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
cache "github.com/argoproj/gitops-engine/pkg/cache"
|
|
|
|
controllercache "github.com/argoproj/argo-cd/v2/controller/cache"
|
|
|
|
kube "github.com/argoproj/gitops-engine/pkg/utils/kube"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
|
|
|
unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
|
|
v1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
|
|
)
|
|
|
|
// LiveStateCache is an autogenerated mock type for the LiveStateCache type
|
|
type LiveStateCache struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// GetClusterCache provides a mock function with given fields: server
|
|
func (_m *LiveStateCache) GetClusterCache(server string) (cache.ClusterCache, error) {
|
|
ret := _m.Called(server)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetClusterCache")
|
|
}
|
|
|
|
var r0 cache.ClusterCache
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (cache.ClusterCache, error)); ok {
|
|
return rf(server)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) cache.ClusterCache); ok {
|
|
r0 = rf(server)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(cache.ClusterCache)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(server)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetClustersInfo provides a mock function with given fields:
|
|
func (_m *LiveStateCache) GetClustersInfo() []cache.ClusterInfo {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetClustersInfo")
|
|
}
|
|
|
|
var r0 []cache.ClusterInfo
|
|
if rf, ok := ret.Get(0).(func() []cache.ClusterInfo); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]cache.ClusterInfo)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetManagedLiveObjs provides a mock function with given fields: a, targetObjs
|
|
func (_m *LiveStateCache) GetManagedLiveObjs(a *v1alpha1.Application, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error) {
|
|
ret := _m.Called(a, targetObjs)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetManagedLiveObjs")
|
|
}
|
|
|
|
var r0 map[kube.ResourceKey]*unstructured.Unstructured
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*v1alpha1.Application, []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error)); ok {
|
|
return rf(a, targetObjs)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*v1alpha1.Application, []*unstructured.Unstructured) map[kube.ResourceKey]*unstructured.Unstructured); ok {
|
|
r0 = rf(a, targetObjs)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(map[kube.ResourceKey]*unstructured.Unstructured)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*v1alpha1.Application, []*unstructured.Unstructured) error); ok {
|
|
r1 = rf(a, targetObjs)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetNamespaceTopLevelResources provides a mock function with given fields: server, namespace
|
|
func (_m *LiveStateCache) GetNamespaceTopLevelResources(server string, namespace string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error) {
|
|
ret := _m.Called(server, namespace)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetNamespaceTopLevelResources")
|
|
}
|
|
|
|
var r0 map[kube.ResourceKey]v1alpha1.ResourceNode
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error)); ok {
|
|
return rf(server, namespace)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) map[kube.ResourceKey]v1alpha1.ResourceNode); ok {
|
|
r0 = rf(server, namespace)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(map[kube.ResourceKey]v1alpha1.ResourceNode)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
|
r1 = rf(server, namespace)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetVersionsInfo provides a mock function with given fields: serverURL
|
|
func (_m *LiveStateCache) GetVersionsInfo(serverURL string) (string, []kube.APIResourceInfo, error) {
|
|
ret := _m.Called(serverURL)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetVersionsInfo")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 []kube.APIResourceInfo
|
|
var r2 error
|
|
if rf, ok := ret.Get(0).(func(string) (string, []kube.APIResourceInfo, error)); ok {
|
|
return rf(serverURL)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) string); ok {
|
|
r0 = rf(serverURL)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) []kube.APIResourceInfo); ok {
|
|
r1 = rf(serverURL)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).([]kube.APIResourceInfo)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(2).(func(string) error); ok {
|
|
r2 = rf(serverURL)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// Init provides a mock function with given fields:
|
|
func (_m *LiveStateCache) Init() error {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Init")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func() error); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// IsNamespaced provides a mock function with given fields: server, gk
|
|
func (_m *LiveStateCache) IsNamespaced(server string, gk schema.GroupKind) (bool, error) {
|
|
ret := _m.Called(server, gk)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for IsNamespaced")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, schema.GroupKind) (bool, error)); ok {
|
|
return rf(server, gk)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, schema.GroupKind) bool); ok {
|
|
r0 = rf(server, gk)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, schema.GroupKind) error); ok {
|
|
r1 = rf(server, gk)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// IterateHierarchy provides a mock function with given fields: server, key, action
|
|
func (_m *LiveStateCache) IterateHierarchy(server string, key kube.ResourceKey, action func(v1alpha1.ResourceNode, string) bool) error {
|
|
ret := _m.Called(server, key, action)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for IterateHierarchy")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, kube.ResourceKey, func(v1alpha1.ResourceNode, string) bool) error); ok {
|
|
r0 = rf(server, key, action)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// IterateHierarchyV2 provides a mock function with given fields: server, keys, action
|
|
func (_m *LiveStateCache) IterateHierarchyV2(server string, keys []kube.ResourceKey, action func(v1alpha1.ResourceNode, string) bool) error {
|
|
ret := _m.Called(server, keys, action)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for IterateHierarchyV2")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, []kube.ResourceKey, func(v1alpha1.ResourceNode, string) bool) error); ok {
|
|
r0 = rf(server, keys, action)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// IterateResources provides a mock function with given fields: server, callback
|
|
func (_m *LiveStateCache) IterateResources(server string, callback func(*cache.Resource, *controllercache.ResourceInfo)) error {
|
|
ret := _m.Called(server, callback)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for IterateResources")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, func(*cache.Resource, *controllercache.ResourceInfo)) error); ok {
|
|
r0 = rf(server, callback)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Run provides a mock function with given fields: ctx
|
|
func (_m *LiveStateCache) Run(ctx context.Context) error {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Run")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewLiveStateCache creates a new instance of LiveStateCache. 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 NewLiveStateCache(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *LiveStateCache {
|
|
mock := &LiveStateCache{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|