github.com/argoproj/argo-cd/v3@v3.2.1/controller/cache/mocks/LiveStateCache.go (about) 1 // Code generated by mockery; DO NOT EDIT. 2 // github.com/vektra/mockery 3 // template: testify 4 5 package mocks 6 7 import ( 8 "context" 9 10 cache0 "github.com/argoproj/argo-cd/v3/controller/cache" 11 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 12 "github.com/argoproj/gitops-engine/pkg/cache" 13 "github.com/argoproj/gitops-engine/pkg/utils/kube" 14 mock "github.com/stretchr/testify/mock" 15 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" 16 "k8s.io/apimachinery/pkg/runtime/schema" 17 ) 18 19 // 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. 20 // The first argument is typically a *testing.T value. 21 func NewLiveStateCache(t interface { 22 mock.TestingT 23 Cleanup(func()) 24 }) *LiveStateCache { 25 mock := &LiveStateCache{} 26 mock.Mock.Test(t) 27 28 t.Cleanup(func() { mock.AssertExpectations(t) }) 29 30 return mock 31 } 32 33 // LiveStateCache is an autogenerated mock type for the LiveStateCache type 34 type LiveStateCache struct { 35 mock.Mock 36 } 37 38 type LiveStateCache_Expecter struct { 39 mock *mock.Mock 40 } 41 42 func (_m *LiveStateCache) EXPECT() *LiveStateCache_Expecter { 43 return &LiveStateCache_Expecter{mock: &_m.Mock} 44 } 45 46 // GetClusterCache provides a mock function for the type LiveStateCache 47 func (_mock *LiveStateCache) GetClusterCache(server *v1alpha1.Cluster) (cache.ClusterCache, error) { 48 ret := _mock.Called(server) 49 50 if len(ret) == 0 { 51 panic("no return value specified for GetClusterCache") 52 } 53 54 var r0 cache.ClusterCache 55 var r1 error 56 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster) (cache.ClusterCache, error)); ok { 57 return returnFunc(server) 58 } 59 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster) cache.ClusterCache); ok { 60 r0 = returnFunc(server) 61 } else { 62 if ret.Get(0) != nil { 63 r0 = ret.Get(0).(cache.ClusterCache) 64 } 65 } 66 if returnFunc, ok := ret.Get(1).(func(*v1alpha1.Cluster) error); ok { 67 r1 = returnFunc(server) 68 } else { 69 r1 = ret.Error(1) 70 } 71 return r0, r1 72 } 73 74 // LiveStateCache_GetClusterCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterCache' 75 type LiveStateCache_GetClusterCache_Call struct { 76 *mock.Call 77 } 78 79 // GetClusterCache is a helper method to define mock.On call 80 // - server *v1alpha1.Cluster 81 func (_e *LiveStateCache_Expecter) GetClusterCache(server interface{}) *LiveStateCache_GetClusterCache_Call { 82 return &LiveStateCache_GetClusterCache_Call{Call: _e.mock.On("GetClusterCache", server)} 83 } 84 85 func (_c *LiveStateCache_GetClusterCache_Call) Run(run func(server *v1alpha1.Cluster)) *LiveStateCache_GetClusterCache_Call { 86 _c.Call.Run(func(args mock.Arguments) { 87 var arg0 *v1alpha1.Cluster 88 if args[0] != nil { 89 arg0 = args[0].(*v1alpha1.Cluster) 90 } 91 run( 92 arg0, 93 ) 94 }) 95 return _c 96 } 97 98 func (_c *LiveStateCache_GetClusterCache_Call) Return(clusterCache cache.ClusterCache, err error) *LiveStateCache_GetClusterCache_Call { 99 _c.Call.Return(clusterCache, err) 100 return _c 101 } 102 103 func (_c *LiveStateCache_GetClusterCache_Call) RunAndReturn(run func(server *v1alpha1.Cluster) (cache.ClusterCache, error)) *LiveStateCache_GetClusterCache_Call { 104 _c.Call.Return(run) 105 return _c 106 } 107 108 // GetClustersInfo provides a mock function for the type LiveStateCache 109 func (_mock *LiveStateCache) GetClustersInfo() []cache.ClusterInfo { 110 ret := _mock.Called() 111 112 if len(ret) == 0 { 113 panic("no return value specified for GetClustersInfo") 114 } 115 116 var r0 []cache.ClusterInfo 117 if returnFunc, ok := ret.Get(0).(func() []cache.ClusterInfo); ok { 118 r0 = returnFunc() 119 } else { 120 if ret.Get(0) != nil { 121 r0 = ret.Get(0).([]cache.ClusterInfo) 122 } 123 } 124 return r0 125 } 126 127 // LiveStateCache_GetClustersInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClustersInfo' 128 type LiveStateCache_GetClustersInfo_Call struct { 129 *mock.Call 130 } 131 132 // GetClustersInfo is a helper method to define mock.On call 133 func (_e *LiveStateCache_Expecter) GetClustersInfo() *LiveStateCache_GetClustersInfo_Call { 134 return &LiveStateCache_GetClustersInfo_Call{Call: _e.mock.On("GetClustersInfo")} 135 } 136 137 func (_c *LiveStateCache_GetClustersInfo_Call) Run(run func()) *LiveStateCache_GetClustersInfo_Call { 138 _c.Call.Run(func(args mock.Arguments) { 139 run() 140 }) 141 return _c 142 } 143 144 func (_c *LiveStateCache_GetClustersInfo_Call) Return(clusterInfos []cache.ClusterInfo) *LiveStateCache_GetClustersInfo_Call { 145 _c.Call.Return(clusterInfos) 146 return _c 147 } 148 149 func (_c *LiveStateCache_GetClustersInfo_Call) RunAndReturn(run func() []cache.ClusterInfo) *LiveStateCache_GetClustersInfo_Call { 150 _c.Call.Return(run) 151 return _c 152 } 153 154 // GetManagedLiveObjs provides a mock function for the type LiveStateCache 155 func (_mock *LiveStateCache) GetManagedLiveObjs(destCluster *v1alpha1.Cluster, a *v1alpha1.Application, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error) { 156 ret := _mock.Called(destCluster, a, targetObjs) 157 158 if len(ret) == 0 { 159 panic("no return value specified for GetManagedLiveObjs") 160 } 161 162 var r0 map[kube.ResourceKey]*unstructured.Unstructured 163 var r1 error 164 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, *v1alpha1.Application, []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error)); ok { 165 return returnFunc(destCluster, a, targetObjs) 166 } 167 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, *v1alpha1.Application, []*unstructured.Unstructured) map[kube.ResourceKey]*unstructured.Unstructured); ok { 168 r0 = returnFunc(destCluster, a, targetObjs) 169 } else { 170 if ret.Get(0) != nil { 171 r0 = ret.Get(0).(map[kube.ResourceKey]*unstructured.Unstructured) 172 } 173 } 174 if returnFunc, ok := ret.Get(1).(func(*v1alpha1.Cluster, *v1alpha1.Application, []*unstructured.Unstructured) error); ok { 175 r1 = returnFunc(destCluster, a, targetObjs) 176 } else { 177 r1 = ret.Error(1) 178 } 179 return r0, r1 180 } 181 182 // LiveStateCache_GetManagedLiveObjs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetManagedLiveObjs' 183 type LiveStateCache_GetManagedLiveObjs_Call struct { 184 *mock.Call 185 } 186 187 // GetManagedLiveObjs is a helper method to define mock.On call 188 // - destCluster *v1alpha1.Cluster 189 // - a *v1alpha1.Application 190 // - targetObjs []*unstructured.Unstructured 191 func (_e *LiveStateCache_Expecter) GetManagedLiveObjs(destCluster interface{}, a interface{}, targetObjs interface{}) *LiveStateCache_GetManagedLiveObjs_Call { 192 return &LiveStateCache_GetManagedLiveObjs_Call{Call: _e.mock.On("GetManagedLiveObjs", destCluster, a, targetObjs)} 193 } 194 195 func (_c *LiveStateCache_GetManagedLiveObjs_Call) Run(run func(destCluster *v1alpha1.Cluster, a *v1alpha1.Application, targetObjs []*unstructured.Unstructured)) *LiveStateCache_GetManagedLiveObjs_Call { 196 _c.Call.Run(func(args mock.Arguments) { 197 var arg0 *v1alpha1.Cluster 198 if args[0] != nil { 199 arg0 = args[0].(*v1alpha1.Cluster) 200 } 201 var arg1 *v1alpha1.Application 202 if args[1] != nil { 203 arg1 = args[1].(*v1alpha1.Application) 204 } 205 var arg2 []*unstructured.Unstructured 206 if args[2] != nil { 207 arg2 = args[2].([]*unstructured.Unstructured) 208 } 209 run( 210 arg0, 211 arg1, 212 arg2, 213 ) 214 }) 215 return _c 216 } 217 218 func (_c *LiveStateCache_GetManagedLiveObjs_Call) Return(resourceKeyToUnstructured map[kube.ResourceKey]*unstructured.Unstructured, err error) *LiveStateCache_GetManagedLiveObjs_Call { 219 _c.Call.Return(resourceKeyToUnstructured, err) 220 return _c 221 } 222 223 func (_c *LiveStateCache_GetManagedLiveObjs_Call) RunAndReturn(run func(destCluster *v1alpha1.Cluster, a *v1alpha1.Application, targetObjs []*unstructured.Unstructured) (map[kube.ResourceKey]*unstructured.Unstructured, error)) *LiveStateCache_GetManagedLiveObjs_Call { 224 _c.Call.Return(run) 225 return _c 226 } 227 228 // GetNamespaceTopLevelResources provides a mock function for the type LiveStateCache 229 func (_mock *LiveStateCache) GetNamespaceTopLevelResources(server *v1alpha1.Cluster, namespace string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error) { 230 ret := _mock.Called(server, namespace) 231 232 if len(ret) == 0 { 233 panic("no return value specified for GetNamespaceTopLevelResources") 234 } 235 236 var r0 map[kube.ResourceKey]v1alpha1.ResourceNode 237 var r1 error 238 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error)); ok { 239 return returnFunc(server, namespace) 240 } 241 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, string) map[kube.ResourceKey]v1alpha1.ResourceNode); ok { 242 r0 = returnFunc(server, namespace) 243 } else { 244 if ret.Get(0) != nil { 245 r0 = ret.Get(0).(map[kube.ResourceKey]v1alpha1.ResourceNode) 246 } 247 } 248 if returnFunc, ok := ret.Get(1).(func(*v1alpha1.Cluster, string) error); ok { 249 r1 = returnFunc(server, namespace) 250 } else { 251 r1 = ret.Error(1) 252 } 253 return r0, r1 254 } 255 256 // LiveStateCache_GetNamespaceTopLevelResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamespaceTopLevelResources' 257 type LiveStateCache_GetNamespaceTopLevelResources_Call struct { 258 *mock.Call 259 } 260 261 // GetNamespaceTopLevelResources is a helper method to define mock.On call 262 // - server *v1alpha1.Cluster 263 // - namespace string 264 func (_e *LiveStateCache_Expecter) GetNamespaceTopLevelResources(server interface{}, namespace interface{}) *LiveStateCache_GetNamespaceTopLevelResources_Call { 265 return &LiveStateCache_GetNamespaceTopLevelResources_Call{Call: _e.mock.On("GetNamespaceTopLevelResources", server, namespace)} 266 } 267 268 func (_c *LiveStateCache_GetNamespaceTopLevelResources_Call) Run(run func(server *v1alpha1.Cluster, namespace string)) *LiveStateCache_GetNamespaceTopLevelResources_Call { 269 _c.Call.Run(func(args mock.Arguments) { 270 var arg0 *v1alpha1.Cluster 271 if args[0] != nil { 272 arg0 = args[0].(*v1alpha1.Cluster) 273 } 274 var arg1 string 275 if args[1] != nil { 276 arg1 = args[1].(string) 277 } 278 run( 279 arg0, 280 arg1, 281 ) 282 }) 283 return _c 284 } 285 286 func (_c *LiveStateCache_GetNamespaceTopLevelResources_Call) Return(resourceKeyToResourceNode map[kube.ResourceKey]v1alpha1.ResourceNode, err error) *LiveStateCache_GetNamespaceTopLevelResources_Call { 287 _c.Call.Return(resourceKeyToResourceNode, err) 288 return _c 289 } 290 291 func (_c *LiveStateCache_GetNamespaceTopLevelResources_Call) RunAndReturn(run func(server *v1alpha1.Cluster, namespace string) (map[kube.ResourceKey]v1alpha1.ResourceNode, error)) *LiveStateCache_GetNamespaceTopLevelResources_Call { 292 _c.Call.Return(run) 293 return _c 294 } 295 296 // GetVersionsInfo provides a mock function for the type LiveStateCache 297 func (_mock *LiveStateCache) GetVersionsInfo(server *v1alpha1.Cluster) (string, []kube.APIResourceInfo, error) { 298 ret := _mock.Called(server) 299 300 if len(ret) == 0 { 301 panic("no return value specified for GetVersionsInfo") 302 } 303 304 var r0 string 305 var r1 []kube.APIResourceInfo 306 var r2 error 307 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster) (string, []kube.APIResourceInfo, error)); ok { 308 return returnFunc(server) 309 } 310 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster) string); ok { 311 r0 = returnFunc(server) 312 } else { 313 r0 = ret.Get(0).(string) 314 } 315 if returnFunc, ok := ret.Get(1).(func(*v1alpha1.Cluster) []kube.APIResourceInfo); ok { 316 r1 = returnFunc(server) 317 } else { 318 if ret.Get(1) != nil { 319 r1 = ret.Get(1).([]kube.APIResourceInfo) 320 } 321 } 322 if returnFunc, ok := ret.Get(2).(func(*v1alpha1.Cluster) error); ok { 323 r2 = returnFunc(server) 324 } else { 325 r2 = ret.Error(2) 326 } 327 return r0, r1, r2 328 } 329 330 // LiveStateCache_GetVersionsInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVersionsInfo' 331 type LiveStateCache_GetVersionsInfo_Call struct { 332 *mock.Call 333 } 334 335 // GetVersionsInfo is a helper method to define mock.On call 336 // - server *v1alpha1.Cluster 337 func (_e *LiveStateCache_Expecter) GetVersionsInfo(server interface{}) *LiveStateCache_GetVersionsInfo_Call { 338 return &LiveStateCache_GetVersionsInfo_Call{Call: _e.mock.On("GetVersionsInfo", server)} 339 } 340 341 func (_c *LiveStateCache_GetVersionsInfo_Call) Run(run func(server *v1alpha1.Cluster)) *LiveStateCache_GetVersionsInfo_Call { 342 _c.Call.Run(func(args mock.Arguments) { 343 var arg0 *v1alpha1.Cluster 344 if args[0] != nil { 345 arg0 = args[0].(*v1alpha1.Cluster) 346 } 347 run( 348 arg0, 349 ) 350 }) 351 return _c 352 } 353 354 func (_c *LiveStateCache_GetVersionsInfo_Call) Return(s string, aPIResourceInfos []kube.APIResourceInfo, err error) *LiveStateCache_GetVersionsInfo_Call { 355 _c.Call.Return(s, aPIResourceInfos, err) 356 return _c 357 } 358 359 func (_c *LiveStateCache_GetVersionsInfo_Call) RunAndReturn(run func(server *v1alpha1.Cluster) (string, []kube.APIResourceInfo, error)) *LiveStateCache_GetVersionsInfo_Call { 360 _c.Call.Return(run) 361 return _c 362 } 363 364 // Init provides a mock function for the type LiveStateCache 365 func (_mock *LiveStateCache) Init() error { 366 ret := _mock.Called() 367 368 if len(ret) == 0 { 369 panic("no return value specified for Init") 370 } 371 372 var r0 error 373 if returnFunc, ok := ret.Get(0).(func() error); ok { 374 r0 = returnFunc() 375 } else { 376 r0 = ret.Error(0) 377 } 378 return r0 379 } 380 381 // LiveStateCache_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init' 382 type LiveStateCache_Init_Call struct { 383 *mock.Call 384 } 385 386 // Init is a helper method to define mock.On call 387 func (_e *LiveStateCache_Expecter) Init() *LiveStateCache_Init_Call { 388 return &LiveStateCache_Init_Call{Call: _e.mock.On("Init")} 389 } 390 391 func (_c *LiveStateCache_Init_Call) Run(run func()) *LiveStateCache_Init_Call { 392 _c.Call.Run(func(args mock.Arguments) { 393 run() 394 }) 395 return _c 396 } 397 398 func (_c *LiveStateCache_Init_Call) Return(err error) *LiveStateCache_Init_Call { 399 _c.Call.Return(err) 400 return _c 401 } 402 403 func (_c *LiveStateCache_Init_Call) RunAndReturn(run func() error) *LiveStateCache_Init_Call { 404 _c.Call.Return(run) 405 return _c 406 } 407 408 // IsNamespaced provides a mock function for the type LiveStateCache 409 func (_mock *LiveStateCache) IsNamespaced(server *v1alpha1.Cluster, gk schema.GroupKind) (bool, error) { 410 ret := _mock.Called(server, gk) 411 412 if len(ret) == 0 { 413 panic("no return value specified for IsNamespaced") 414 } 415 416 var r0 bool 417 var r1 error 418 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, schema.GroupKind) (bool, error)); ok { 419 return returnFunc(server, gk) 420 } 421 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, schema.GroupKind) bool); ok { 422 r0 = returnFunc(server, gk) 423 } else { 424 r0 = ret.Get(0).(bool) 425 } 426 if returnFunc, ok := ret.Get(1).(func(*v1alpha1.Cluster, schema.GroupKind) error); ok { 427 r1 = returnFunc(server, gk) 428 } else { 429 r1 = ret.Error(1) 430 } 431 return r0, r1 432 } 433 434 // LiveStateCache_IsNamespaced_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsNamespaced' 435 type LiveStateCache_IsNamespaced_Call struct { 436 *mock.Call 437 } 438 439 // IsNamespaced is a helper method to define mock.On call 440 // - server *v1alpha1.Cluster 441 // - gk schema.GroupKind 442 func (_e *LiveStateCache_Expecter) IsNamespaced(server interface{}, gk interface{}) *LiveStateCache_IsNamespaced_Call { 443 return &LiveStateCache_IsNamespaced_Call{Call: _e.mock.On("IsNamespaced", server, gk)} 444 } 445 446 func (_c *LiveStateCache_IsNamespaced_Call) Run(run func(server *v1alpha1.Cluster, gk schema.GroupKind)) *LiveStateCache_IsNamespaced_Call { 447 _c.Call.Run(func(args mock.Arguments) { 448 var arg0 *v1alpha1.Cluster 449 if args[0] != nil { 450 arg0 = args[0].(*v1alpha1.Cluster) 451 } 452 var arg1 schema.GroupKind 453 if args[1] != nil { 454 arg1 = args[1].(schema.GroupKind) 455 } 456 run( 457 arg0, 458 arg1, 459 ) 460 }) 461 return _c 462 } 463 464 func (_c *LiveStateCache_IsNamespaced_Call) Return(b bool, err error) *LiveStateCache_IsNamespaced_Call { 465 _c.Call.Return(b, err) 466 return _c 467 } 468 469 func (_c *LiveStateCache_IsNamespaced_Call) RunAndReturn(run func(server *v1alpha1.Cluster, gk schema.GroupKind) (bool, error)) *LiveStateCache_IsNamespaced_Call { 470 _c.Call.Return(run) 471 return _c 472 } 473 474 // IterateHierarchyV2 provides a mock function for the type LiveStateCache 475 func (_mock *LiveStateCache) IterateHierarchyV2(server *v1alpha1.Cluster, keys []kube.ResourceKey, action func(child v1alpha1.ResourceNode, appName string) bool) error { 476 ret := _mock.Called(server, keys, action) 477 478 if len(ret) == 0 { 479 panic("no return value specified for IterateHierarchyV2") 480 } 481 482 var r0 error 483 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, []kube.ResourceKey, func(child v1alpha1.ResourceNode, appName string) bool) error); ok { 484 r0 = returnFunc(server, keys, action) 485 } else { 486 r0 = ret.Error(0) 487 } 488 return r0 489 } 490 491 // LiveStateCache_IterateHierarchyV2_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IterateHierarchyV2' 492 type LiveStateCache_IterateHierarchyV2_Call struct { 493 *mock.Call 494 } 495 496 // IterateHierarchyV2 is a helper method to define mock.On call 497 // - server *v1alpha1.Cluster 498 // - keys []kube.ResourceKey 499 // - action func(child v1alpha1.ResourceNode, appName string) bool 500 func (_e *LiveStateCache_Expecter) IterateHierarchyV2(server interface{}, keys interface{}, action interface{}) *LiveStateCache_IterateHierarchyV2_Call { 501 return &LiveStateCache_IterateHierarchyV2_Call{Call: _e.mock.On("IterateHierarchyV2", server, keys, action)} 502 } 503 504 func (_c *LiveStateCache_IterateHierarchyV2_Call) Run(run func(server *v1alpha1.Cluster, keys []kube.ResourceKey, action func(child v1alpha1.ResourceNode, appName string) bool)) *LiveStateCache_IterateHierarchyV2_Call { 505 _c.Call.Run(func(args mock.Arguments) { 506 var arg0 *v1alpha1.Cluster 507 if args[0] != nil { 508 arg0 = args[0].(*v1alpha1.Cluster) 509 } 510 var arg1 []kube.ResourceKey 511 if args[1] != nil { 512 arg1 = args[1].([]kube.ResourceKey) 513 } 514 var arg2 func(child v1alpha1.ResourceNode, appName string) bool 515 if args[2] != nil { 516 arg2 = args[2].(func(child v1alpha1.ResourceNode, appName string) bool) 517 } 518 run( 519 arg0, 520 arg1, 521 arg2, 522 ) 523 }) 524 return _c 525 } 526 527 func (_c *LiveStateCache_IterateHierarchyV2_Call) Return(err error) *LiveStateCache_IterateHierarchyV2_Call { 528 _c.Call.Return(err) 529 return _c 530 } 531 532 func (_c *LiveStateCache_IterateHierarchyV2_Call) RunAndReturn(run func(server *v1alpha1.Cluster, keys []kube.ResourceKey, action func(child v1alpha1.ResourceNode, appName string) bool) error) *LiveStateCache_IterateHierarchyV2_Call { 533 _c.Call.Return(run) 534 return _c 535 } 536 537 // IterateResources provides a mock function for the type LiveStateCache 538 func (_mock *LiveStateCache) IterateResources(server *v1alpha1.Cluster, callback func(res *cache.Resource, info *cache0.ResourceInfo)) error { 539 ret := _mock.Called(server, callback) 540 541 if len(ret) == 0 { 542 panic("no return value specified for IterateResources") 543 } 544 545 var r0 error 546 if returnFunc, ok := ret.Get(0).(func(*v1alpha1.Cluster, func(res *cache.Resource, info *cache0.ResourceInfo)) error); ok { 547 r0 = returnFunc(server, callback) 548 } else { 549 r0 = ret.Error(0) 550 } 551 return r0 552 } 553 554 // LiveStateCache_IterateResources_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IterateResources' 555 type LiveStateCache_IterateResources_Call struct { 556 *mock.Call 557 } 558 559 // IterateResources is a helper method to define mock.On call 560 // - server *v1alpha1.Cluster 561 // - callback func(res *cache.Resource, info *cache0.ResourceInfo) 562 func (_e *LiveStateCache_Expecter) IterateResources(server interface{}, callback interface{}) *LiveStateCache_IterateResources_Call { 563 return &LiveStateCache_IterateResources_Call{Call: _e.mock.On("IterateResources", server, callback)} 564 } 565 566 func (_c *LiveStateCache_IterateResources_Call) Run(run func(server *v1alpha1.Cluster, callback func(res *cache.Resource, info *cache0.ResourceInfo))) *LiveStateCache_IterateResources_Call { 567 _c.Call.Run(func(args mock.Arguments) { 568 var arg0 *v1alpha1.Cluster 569 if args[0] != nil { 570 arg0 = args[0].(*v1alpha1.Cluster) 571 } 572 var arg1 func(res *cache.Resource, info *cache0.ResourceInfo) 573 if args[1] != nil { 574 arg1 = args[1].(func(res *cache.Resource, info *cache0.ResourceInfo)) 575 } 576 run( 577 arg0, 578 arg1, 579 ) 580 }) 581 return _c 582 } 583 584 func (_c *LiveStateCache_IterateResources_Call) Return(err error) *LiveStateCache_IterateResources_Call { 585 _c.Call.Return(err) 586 return _c 587 } 588 589 func (_c *LiveStateCache_IterateResources_Call) RunAndReturn(run func(server *v1alpha1.Cluster, callback func(res *cache.Resource, info *cache0.ResourceInfo)) error) *LiveStateCache_IterateResources_Call { 590 _c.Call.Return(run) 591 return _c 592 } 593 594 // Run provides a mock function for the type LiveStateCache 595 func (_mock *LiveStateCache) Run(ctx context.Context) error { 596 ret := _mock.Called(ctx) 597 598 if len(ret) == 0 { 599 panic("no return value specified for Run") 600 } 601 602 var r0 error 603 if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { 604 r0 = returnFunc(ctx) 605 } else { 606 r0 = ret.Error(0) 607 } 608 return r0 609 } 610 611 // LiveStateCache_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run' 612 type LiveStateCache_Run_Call struct { 613 *mock.Call 614 } 615 616 // Run is a helper method to define mock.On call 617 // - ctx context.Context 618 func (_e *LiveStateCache_Expecter) Run(ctx interface{}) *LiveStateCache_Run_Call { 619 return &LiveStateCache_Run_Call{Call: _e.mock.On("Run", ctx)} 620 } 621 622 func (_c *LiveStateCache_Run_Call) Run(run func(ctx context.Context)) *LiveStateCache_Run_Call { 623 _c.Call.Run(func(args mock.Arguments) { 624 var arg0 context.Context 625 if args[0] != nil { 626 arg0 = args[0].(context.Context) 627 } 628 run( 629 arg0, 630 ) 631 }) 632 return _c 633 } 634 635 func (_c *LiveStateCache_Run_Call) Return(err error) *LiveStateCache_Run_Call { 636 _c.Call.Return(err) 637 return _c 638 } 639 640 func (_c *LiveStateCache_Run_Call) RunAndReturn(run func(ctx context.Context) error) *LiveStateCache_Run_Call { 641 _c.Call.Return(run) 642 return _c 643 } 644 645 // UpdateShard provides a mock function for the type LiveStateCache 646 func (_mock *LiveStateCache) UpdateShard(shard int) bool { 647 ret := _mock.Called(shard) 648 649 if len(ret) == 0 { 650 panic("no return value specified for UpdateShard") 651 } 652 653 var r0 bool 654 if returnFunc, ok := ret.Get(0).(func(int) bool); ok { 655 r0 = returnFunc(shard) 656 } else { 657 r0 = ret.Get(0).(bool) 658 } 659 return r0 660 } 661 662 // LiveStateCache_UpdateShard_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateShard' 663 type LiveStateCache_UpdateShard_Call struct { 664 *mock.Call 665 } 666 667 // UpdateShard is a helper method to define mock.On call 668 // - shard int 669 func (_e *LiveStateCache_Expecter) UpdateShard(shard interface{}) *LiveStateCache_UpdateShard_Call { 670 return &LiveStateCache_UpdateShard_Call{Call: _e.mock.On("UpdateShard", shard)} 671 } 672 673 func (_c *LiveStateCache_UpdateShard_Call) Run(run func(shard int)) *LiveStateCache_UpdateShard_Call { 674 _c.Call.Run(func(args mock.Arguments) { 675 var arg0 int 676 if args[0] != nil { 677 arg0 = args[0].(int) 678 } 679 run( 680 arg0, 681 ) 682 }) 683 return _c 684 } 685 686 func (_c *LiveStateCache_UpdateShard_Call) Return(b bool) *LiveStateCache_UpdateShard_Call { 687 _c.Call.Return(b) 688 return _c 689 } 690 691 func (_c *LiveStateCache_UpdateShard_Call) RunAndReturn(run func(shard int) bool) *LiveStateCache_UpdateShard_Call { 692 _c.Call.Return(run) 693 return _c 694 }