github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/mocks/Manager.go (about) 1 // Code generated by mockery v2.31.4. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 context "context" 7 8 enginetypes "github.com/projecteru2/core/engine/types" 9 coretypes "github.com/projecteru2/core/types" 10 11 mock "github.com/stretchr/testify/mock" 12 13 pluginstypes "github.com/projecteru2/core/resource/plugins/types" 14 15 types "github.com/projecteru2/core/resource/types" 16 ) 17 18 // Manager is an autogenerated mock type for the Manager type 19 type Manager struct { 20 mock.Mock 21 } 22 23 // AddNode provides a mock function with given fields: _a0, _a1, _a2, _a3 24 func (_m *Manager) AddNode(_a0 context.Context, _a1 string, _a2 types.Resources, _a3 *enginetypes.Info) (types.Resources, error) { 25 ret := _m.Called(_a0, _a1, _a2, _a3) 26 27 var r0 types.Resources 28 var r1 error 29 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, *enginetypes.Info) (types.Resources, error)); ok { 30 return rf(_a0, _a1, _a2, _a3) 31 } 32 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, *enginetypes.Info) types.Resources); ok { 33 r0 = rf(_a0, _a1, _a2, _a3) 34 } else { 35 if ret.Get(0) != nil { 36 r0 = ret.Get(0).(types.Resources) 37 } 38 } 39 40 if rf, ok := ret.Get(1).(func(context.Context, string, types.Resources, *enginetypes.Info) error); ok { 41 r1 = rf(_a0, _a1, _a2, _a3) 42 } else { 43 r1 = ret.Error(1) 44 } 45 46 return r0, r1 47 } 48 49 // Alloc provides a mock function with given fields: _a0, _a1, _a2, _a3 50 func (_m *Manager) Alloc(_a0 context.Context, _a1 string, _a2 int, _a3 types.Resources) ([]types.Resources, []types.Resources, error) { 51 ret := _m.Called(_a0, _a1, _a2, _a3) 52 53 var r0 []types.Resources 54 var r1 []types.Resources 55 var r2 error 56 if rf, ok := ret.Get(0).(func(context.Context, string, int, types.Resources) ([]types.Resources, []types.Resources, error)); ok { 57 return rf(_a0, _a1, _a2, _a3) 58 } 59 if rf, ok := ret.Get(0).(func(context.Context, string, int, types.Resources) []types.Resources); ok { 60 r0 = rf(_a0, _a1, _a2, _a3) 61 } else { 62 if ret.Get(0) != nil { 63 r0 = ret.Get(0).([]types.Resources) 64 } 65 } 66 67 if rf, ok := ret.Get(1).(func(context.Context, string, int, types.Resources) []types.Resources); ok { 68 r1 = rf(_a0, _a1, _a2, _a3) 69 } else { 70 if ret.Get(1) != nil { 71 r1 = ret.Get(1).([]types.Resources) 72 } 73 } 74 75 if rf, ok := ret.Get(2).(func(context.Context, string, int, types.Resources) error); ok { 76 r2 = rf(_a0, _a1, _a2, _a3) 77 } else { 78 r2 = ret.Error(2) 79 } 80 81 return r0, r1, r2 82 } 83 84 // GetMetricsDescription provides a mock function with given fields: _a0 85 func (_m *Manager) GetMetricsDescription(_a0 context.Context) ([]*pluginstypes.MetricsDescription, error) { 86 ret := _m.Called(_a0) 87 88 var r0 []*pluginstypes.MetricsDescription 89 var r1 error 90 if rf, ok := ret.Get(0).(func(context.Context) ([]*pluginstypes.MetricsDescription, error)); ok { 91 return rf(_a0) 92 } 93 if rf, ok := ret.Get(0).(func(context.Context) []*pluginstypes.MetricsDescription); ok { 94 r0 = rf(_a0) 95 } else { 96 if ret.Get(0) != nil { 97 r0 = ret.Get(0).([]*pluginstypes.MetricsDescription) 98 } 99 } 100 101 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 102 r1 = rf(_a0) 103 } else { 104 r1 = ret.Error(1) 105 } 106 107 return r0, r1 108 } 109 110 // GetMostIdleNode provides a mock function with given fields: _a0, _a1 111 func (_m *Manager) GetMostIdleNode(_a0 context.Context, _a1 []string) (string, error) { 112 ret := _m.Called(_a0, _a1) 113 114 var r0 string 115 var r1 error 116 if rf, ok := ret.Get(0).(func(context.Context, []string) (string, error)); ok { 117 return rf(_a0, _a1) 118 } 119 if rf, ok := ret.Get(0).(func(context.Context, []string) string); ok { 120 r0 = rf(_a0, _a1) 121 } else { 122 r0 = ret.Get(0).(string) 123 } 124 125 if rf, ok := ret.Get(1).(func(context.Context, []string) error); ok { 126 r1 = rf(_a0, _a1) 127 } else { 128 r1 = ret.Error(1) 129 } 130 131 return r0, r1 132 } 133 134 // GetNodeMetrics provides a mock function with given fields: _a0, _a1 135 func (_m *Manager) GetNodeMetrics(_a0 context.Context, _a1 *coretypes.Node) ([]*pluginstypes.Metrics, error) { 136 ret := _m.Called(_a0, _a1) 137 138 var r0 []*pluginstypes.Metrics 139 var r1 error 140 if rf, ok := ret.Get(0).(func(context.Context, *coretypes.Node) ([]*pluginstypes.Metrics, error)); ok { 141 return rf(_a0, _a1) 142 } 143 if rf, ok := ret.Get(0).(func(context.Context, *coretypes.Node) []*pluginstypes.Metrics); ok { 144 r0 = rf(_a0, _a1) 145 } else { 146 if ret.Get(0) != nil { 147 r0 = ret.Get(0).([]*pluginstypes.Metrics) 148 } 149 } 150 151 if rf, ok := ret.Get(1).(func(context.Context, *coretypes.Node) error); ok { 152 r1 = rf(_a0, _a1) 153 } else { 154 r1 = ret.Error(1) 155 } 156 157 return r0, r1 158 } 159 160 // GetNodeResourceInfo provides a mock function with given fields: _a0, _a1, _a2, _a3 161 func (_m *Manager) GetNodeResourceInfo(_a0 context.Context, _a1 string, _a2 []*coretypes.Workload, _a3 bool) (types.Resources, types.Resources, []string, error) { 162 ret := _m.Called(_a0, _a1, _a2, _a3) 163 164 var r0 types.Resources 165 var r1 types.Resources 166 var r2 []string 167 var r3 error 168 if rf, ok := ret.Get(0).(func(context.Context, string, []*coretypes.Workload, bool) (types.Resources, types.Resources, []string, error)); ok { 169 return rf(_a0, _a1, _a2, _a3) 170 } 171 if rf, ok := ret.Get(0).(func(context.Context, string, []*coretypes.Workload, bool) types.Resources); ok { 172 r0 = rf(_a0, _a1, _a2, _a3) 173 } else { 174 if ret.Get(0) != nil { 175 r0 = ret.Get(0).(types.Resources) 176 } 177 } 178 179 if rf, ok := ret.Get(1).(func(context.Context, string, []*coretypes.Workload, bool) types.Resources); ok { 180 r1 = rf(_a0, _a1, _a2, _a3) 181 } else { 182 if ret.Get(1) != nil { 183 r1 = ret.Get(1).(types.Resources) 184 } 185 } 186 187 if rf, ok := ret.Get(2).(func(context.Context, string, []*coretypes.Workload, bool) []string); ok { 188 r2 = rf(_a0, _a1, _a2, _a3) 189 } else { 190 if ret.Get(2) != nil { 191 r2 = ret.Get(2).([]string) 192 } 193 } 194 195 if rf, ok := ret.Get(3).(func(context.Context, string, []*coretypes.Workload, bool) error); ok { 196 r3 = rf(_a0, _a1, _a2, _a3) 197 } else { 198 r3 = ret.Error(3) 199 } 200 201 return r0, r1, r2, r3 202 } 203 204 // GetNodesDeployCapacity provides a mock function with given fields: _a0, _a1, _a2 205 func (_m *Manager) GetNodesDeployCapacity(_a0 context.Context, _a1 []string, _a2 types.Resources) (map[string]*pluginstypes.NodeDeployCapacity, int, error) { 206 ret := _m.Called(_a0, _a1, _a2) 207 208 var r0 map[string]*pluginstypes.NodeDeployCapacity 209 var r1 int 210 var r2 error 211 if rf, ok := ret.Get(0).(func(context.Context, []string, types.Resources) (map[string]*pluginstypes.NodeDeployCapacity, int, error)); ok { 212 return rf(_a0, _a1, _a2) 213 } 214 if rf, ok := ret.Get(0).(func(context.Context, []string, types.Resources) map[string]*pluginstypes.NodeDeployCapacity); ok { 215 r0 = rf(_a0, _a1, _a2) 216 } else { 217 if ret.Get(0) != nil { 218 r0 = ret.Get(0).(map[string]*pluginstypes.NodeDeployCapacity) 219 } 220 } 221 222 if rf, ok := ret.Get(1).(func(context.Context, []string, types.Resources) int); ok { 223 r1 = rf(_a0, _a1, _a2) 224 } else { 225 r1 = ret.Get(1).(int) 226 } 227 228 if rf, ok := ret.Get(2).(func(context.Context, []string, types.Resources) error); ok { 229 r2 = rf(_a0, _a1, _a2) 230 } else { 231 r2 = ret.Error(2) 232 } 233 234 return r0, r1, r2 235 } 236 237 // Realloc provides a mock function with given fields: _a0, _a1, _a2, _a3 238 func (_m *Manager) Realloc(_a0 context.Context, _a1 string, _a2 types.Resources, _a3 types.Resources) (types.Resources, types.Resources, types.Resources, error) { 239 ret := _m.Called(_a0, _a1, _a2, _a3) 240 241 var r0 types.Resources 242 var r1 types.Resources 243 var r2 types.Resources 244 var r3 error 245 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources) (types.Resources, types.Resources, types.Resources, error)); ok { 246 return rf(_a0, _a1, _a2, _a3) 247 } 248 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources) types.Resources); ok { 249 r0 = rf(_a0, _a1, _a2, _a3) 250 } else { 251 if ret.Get(0) != nil { 252 r0 = ret.Get(0).(types.Resources) 253 } 254 } 255 256 if rf, ok := ret.Get(1).(func(context.Context, string, types.Resources, types.Resources) types.Resources); ok { 257 r1 = rf(_a0, _a1, _a2, _a3) 258 } else { 259 if ret.Get(1) != nil { 260 r1 = ret.Get(1).(types.Resources) 261 } 262 } 263 264 if rf, ok := ret.Get(2).(func(context.Context, string, types.Resources, types.Resources) types.Resources); ok { 265 r2 = rf(_a0, _a1, _a2, _a3) 266 } else { 267 if ret.Get(2) != nil { 268 r2 = ret.Get(2).(types.Resources) 269 } 270 } 271 272 if rf, ok := ret.Get(3).(func(context.Context, string, types.Resources, types.Resources) error); ok { 273 r3 = rf(_a0, _a1, _a2, _a3) 274 } else { 275 r3 = ret.Error(3) 276 } 277 278 return r0, r1, r2, r3 279 } 280 281 // Remap provides a mock function with given fields: _a0, _a1, _a2 282 func (_m *Manager) Remap(_a0 context.Context, _a1 string, _a2 []*coretypes.Workload) (map[string]types.Resources, error) { 283 ret := _m.Called(_a0, _a1, _a2) 284 285 var r0 map[string]types.Resources 286 var r1 error 287 if rf, ok := ret.Get(0).(func(context.Context, string, []*coretypes.Workload) (map[string]types.Resources, error)); ok { 288 return rf(_a0, _a1, _a2) 289 } 290 if rf, ok := ret.Get(0).(func(context.Context, string, []*coretypes.Workload) map[string]types.Resources); ok { 291 r0 = rf(_a0, _a1, _a2) 292 } else { 293 if ret.Get(0) != nil { 294 r0 = ret.Get(0).(map[string]types.Resources) 295 } 296 } 297 298 if rf, ok := ret.Get(1).(func(context.Context, string, []*coretypes.Workload) error); ok { 299 r1 = rf(_a0, _a1, _a2) 300 } else { 301 r1 = ret.Error(1) 302 } 303 304 return r0, r1 305 } 306 307 // RemoveNode provides a mock function with given fields: _a0, _a1 308 func (_m *Manager) RemoveNode(_a0 context.Context, _a1 string) error { 309 ret := _m.Called(_a0, _a1) 310 311 var r0 error 312 if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { 313 r0 = rf(_a0, _a1) 314 } else { 315 r0 = ret.Error(0) 316 } 317 318 return r0 319 } 320 321 // RollbackAlloc provides a mock function with given fields: _a0, _a1, _a2 322 func (_m *Manager) RollbackAlloc(_a0 context.Context, _a1 string, _a2 []types.Resources) error { 323 ret := _m.Called(_a0, _a1, _a2) 324 325 var r0 error 326 if rf, ok := ret.Get(0).(func(context.Context, string, []types.Resources) error); ok { 327 r0 = rf(_a0, _a1, _a2) 328 } else { 329 r0 = ret.Error(0) 330 } 331 332 return r0 333 } 334 335 // RollbackRealloc provides a mock function with given fields: _a0, _a1, _a2 336 func (_m *Manager) RollbackRealloc(_a0 context.Context, _a1 string, _a2 types.Resources) error { 337 ret := _m.Called(_a0, _a1, _a2) 338 339 var r0 error 340 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources) error); ok { 341 r0 = rf(_a0, _a1, _a2) 342 } else { 343 r0 = ret.Error(0) 344 } 345 346 return r0 347 } 348 349 // SetNodeResourceCapacity provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 350 func (_m *Manager) SetNodeResourceCapacity(_a0 context.Context, _a1 string, _a2 types.Resources, _a3 types.Resources, _a4 bool, _a5 bool) (types.Resources, types.Resources, error) { 351 ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) 352 353 var r0 types.Resources 354 var r1 types.Resources 355 var r2 error 356 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources, bool, bool) (types.Resources, types.Resources, error)); ok { 357 return rf(_a0, _a1, _a2, _a3, _a4, _a5) 358 } 359 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources, bool, bool) types.Resources); ok { 360 r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5) 361 } else { 362 if ret.Get(0) != nil { 363 r0 = ret.Get(0).(types.Resources) 364 } 365 } 366 367 if rf, ok := ret.Get(1).(func(context.Context, string, types.Resources, types.Resources, bool, bool) types.Resources); ok { 368 r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5) 369 } else { 370 if ret.Get(1) != nil { 371 r1 = ret.Get(1).(types.Resources) 372 } 373 } 374 375 if rf, ok := ret.Get(2).(func(context.Context, string, types.Resources, types.Resources, bool, bool) error); ok { 376 r2 = rf(_a0, _a1, _a2, _a3, _a4, _a5) 377 } else { 378 r2 = ret.Error(2) 379 } 380 381 return r0, r1, r2 382 } 383 384 // SetNodeResourceUsage provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5, _a6 385 func (_m *Manager) SetNodeResourceUsage(_a0 context.Context, _a1 string, _a2 types.Resources, _a3 types.Resources, _a4 []types.Resources, _a5 bool, _a6 bool) (types.Resources, types.Resources, error) { 386 ret := _m.Called(_a0, _a1, _a2, _a3, _a4, _a5, _a6) 387 388 var r0 types.Resources 389 var r1 types.Resources 390 var r2 error 391 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources, []types.Resources, bool, bool) (types.Resources, types.Resources, error)); ok { 392 return rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) 393 } 394 if rf, ok := ret.Get(0).(func(context.Context, string, types.Resources, types.Resources, []types.Resources, bool, bool) types.Resources); ok { 395 r0 = rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) 396 } else { 397 if ret.Get(0) != nil { 398 r0 = ret.Get(0).(types.Resources) 399 } 400 } 401 402 if rf, ok := ret.Get(1).(func(context.Context, string, types.Resources, types.Resources, []types.Resources, bool, bool) types.Resources); ok { 403 r1 = rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) 404 } else { 405 if ret.Get(1) != nil { 406 r1 = ret.Get(1).(types.Resources) 407 } 408 } 409 410 if rf, ok := ret.Get(2).(func(context.Context, string, types.Resources, types.Resources, []types.Resources, bool, bool) error); ok { 411 r2 = rf(_a0, _a1, _a2, _a3, _a4, _a5, _a6) 412 } else { 413 r2 = ret.Error(2) 414 } 415 416 return r0, r1, r2 417 } 418 419 // NewManager creates a new instance of Manager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 420 // The first argument is typically a *testing.T value. 421 func NewManager(t interface { 422 mock.TestingT 423 Cleanup(func()) 424 }) *Manager { 425 mock := &Manager{} 426 mock.Mock.Test(t) 427 428 t.Cleanup(func() { mock.AssertExpectations(t) }) 429 430 return mock 431 }