/
sigs_client_moq.go
581 lines (544 loc) · 16.8 KB
/
sigs_client_moq.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package fake
import (
"context"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
"sync"
)
// Ensure, that SigsClientInterfaceMock does implement SigsClientInterface.
// If this is not the case, regenerate this file with moq.
var _ SigsClientInterface = &SigsClientInterfaceMock{}
// SigsClientInterfaceMock is a mock implementation of SigsClientInterface.
//
// func TestSomethingThatUsesSigsClientInterface(t *testing.T) {
//
// // make and configure a mocked SigsClientInterface
// mockedSigsClientInterface := &SigsClientInterfaceMock{
// CreateFunc: func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.CreateOption) error {
// panic("mock out the Create method")
// },
// DeleteFunc: func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteOption) error {
// panic("mock out the Delete method")
// },
// DeleteAllOfFunc: func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteAllOfOption) error {
// panic("mock out the DeleteAllOf method")
// },
// GetFunc: func(ctx context.Context, key types.NamespacedName, obj k8sclient.Object) error {
// panic("mock out the Get method")
// },
// GetSigsClientFunc: func() k8sclient.Client {
// panic("mock out the GetSigsClient method")
// },
// ListFunc: func(ctx context.Context, list k8sclient.ObjectList, opts ...k8sclient.ListOption) error {
// panic("mock out the List method")
// },
// PatchFunc: func(ctx context.Context, obj k8sclient.Object, patch k8sclient.Patch, opts ...k8sclient.PatchOption) error {
// panic("mock out the Patch method")
// },
// RESTMapperFunc: func() meta.RESTMapper {
// panic("mock out the RESTMapper method")
// },
// SchemeFunc: func() *runtime.Scheme {
// panic("mock out the Scheme method")
// },
// StatusFunc: func() k8sclient.StatusWriter {
// panic("mock out the Status method")
// },
// UpdateFunc: func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.UpdateOption) error {
// panic("mock out the Update method")
// },
// }
//
// // use mockedSigsClientInterface in code that requires SigsClientInterface
// // and then make assertions.
//
// }
type SigsClientInterfaceMock struct {
// CreateFunc mocks the Create method.
CreateFunc func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.CreateOption) error
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteOption) error
// DeleteAllOfFunc mocks the DeleteAllOf method.
DeleteAllOfFunc func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteAllOfOption) error
// GetFunc mocks the Get method.
GetFunc func(ctx context.Context, key types.NamespacedName, obj k8sclient.Object) error
// GetSigsClientFunc mocks the GetSigsClient method.
GetSigsClientFunc func() k8sclient.Client
// ListFunc mocks the List method.
ListFunc func(ctx context.Context, list k8sclient.ObjectList, opts ...k8sclient.ListOption) error
// PatchFunc mocks the Patch method.
PatchFunc func(ctx context.Context, obj k8sclient.Object, patch k8sclient.Patch, opts ...k8sclient.PatchOption) error
// RESTMapperFunc mocks the RESTMapper method.
RESTMapperFunc func() meta.RESTMapper
// SchemeFunc mocks the Scheme method.
SchemeFunc func() *runtime.Scheme
// StatusFunc mocks the Status method.
StatusFunc func() k8sclient.StatusWriter
// UpdateFunc mocks the Update method.
UpdateFunc func(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.UpdateOption) error
// calls tracks calls to the methods.
calls struct {
// Create holds details about calls to the Create method.
Create []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Obj is the obj argument value.
Obj k8sclient.Object
// Opts is the opts argument value.
Opts []k8sclient.CreateOption
}
// Delete holds details about calls to the Delete method.
Delete []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Obj is the obj argument value.
Obj k8sclient.Object
// Opts is the opts argument value.
Opts []k8sclient.DeleteOption
}
// DeleteAllOf holds details about calls to the DeleteAllOf method.
DeleteAllOf []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Obj is the obj argument value.
Obj k8sclient.Object
// Opts is the opts argument value.
Opts []k8sclient.DeleteAllOfOption
}
// Get holds details about calls to the Get method.
Get []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Key is the key argument value.
Key types.NamespacedName
// Obj is the obj argument value.
Obj k8sclient.Object
}
// GetSigsClient holds details about calls to the GetSigsClient method.
GetSigsClient []struct {
}
// List holds details about calls to the List method.
List []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// List is the list argument value.
List k8sclient.ObjectList
// Opts is the opts argument value.
Opts []k8sclient.ListOption
}
// Patch holds details about calls to the Patch method.
Patch []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Obj is the obj argument value.
Obj k8sclient.Object
// Patch is the patch argument value.
Patch k8sclient.Patch
// Opts is the opts argument value.
Opts []k8sclient.PatchOption
}
// RESTMapper holds details about calls to the RESTMapper method.
RESTMapper []struct {
}
// Scheme holds details about calls to the Scheme method.
Scheme []struct {
}
// Status holds details about calls to the Status method.
Status []struct {
}
// Update holds details about calls to the Update method.
Update []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// Obj is the obj argument value.
Obj k8sclient.Object
// Opts is the opts argument value.
Opts []k8sclient.UpdateOption
}
}
lockCreate sync.RWMutex
lockDelete sync.RWMutex
lockDeleteAllOf sync.RWMutex
lockGet sync.RWMutex
lockGetSigsClient sync.RWMutex
lockList sync.RWMutex
lockPatch sync.RWMutex
lockRESTMapper sync.RWMutex
lockScheme sync.RWMutex
lockStatus sync.RWMutex
lockUpdate sync.RWMutex
}
// Create calls CreateFunc.
func (mock *SigsClientInterfaceMock) Create(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.CreateOption) error {
if mock.CreateFunc == nil {
panic("SigsClientInterfaceMock.CreateFunc: method is nil but SigsClientInterface.Create was just called")
}
callInfo := struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.CreateOption
}{
Ctx: ctx,
Obj: obj,
Opts: opts,
}
mock.lockCreate.Lock()
mock.calls.Create = append(mock.calls.Create, callInfo)
mock.lockCreate.Unlock()
return mock.CreateFunc(ctx, obj, opts...)
}
// CreateCalls gets all the calls that were made to Create.
// Check the length with:
//
// len(mockedSigsClientInterface.CreateCalls())
func (mock *SigsClientInterfaceMock) CreateCalls() []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.CreateOption
} {
var calls []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.CreateOption
}
mock.lockCreate.RLock()
calls = mock.calls.Create
mock.lockCreate.RUnlock()
return calls
}
// Delete calls DeleteFunc.
func (mock *SigsClientInterfaceMock) Delete(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteOption) error {
if mock.DeleteFunc == nil {
panic("SigsClientInterfaceMock.DeleteFunc: method is nil but SigsClientInterface.Delete was just called")
}
callInfo := struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteOption
}{
Ctx: ctx,
Obj: obj,
Opts: opts,
}
mock.lockDelete.Lock()
mock.calls.Delete = append(mock.calls.Delete, callInfo)
mock.lockDelete.Unlock()
return mock.DeleteFunc(ctx, obj, opts...)
}
// DeleteCalls gets all the calls that were made to Delete.
// Check the length with:
//
// len(mockedSigsClientInterface.DeleteCalls())
func (mock *SigsClientInterfaceMock) DeleteCalls() []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteOption
} {
var calls []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteOption
}
mock.lockDelete.RLock()
calls = mock.calls.Delete
mock.lockDelete.RUnlock()
return calls
}
// DeleteAllOf calls DeleteAllOfFunc.
func (mock *SigsClientInterfaceMock) DeleteAllOf(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.DeleteAllOfOption) error {
if mock.DeleteAllOfFunc == nil {
panic("SigsClientInterfaceMock.DeleteAllOfFunc: method is nil but SigsClientInterface.DeleteAllOf was just called")
}
callInfo := struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteAllOfOption
}{
Ctx: ctx,
Obj: obj,
Opts: opts,
}
mock.lockDeleteAllOf.Lock()
mock.calls.DeleteAllOf = append(mock.calls.DeleteAllOf, callInfo)
mock.lockDeleteAllOf.Unlock()
return mock.DeleteAllOfFunc(ctx, obj, opts...)
}
// DeleteAllOfCalls gets all the calls that were made to DeleteAllOf.
// Check the length with:
//
// len(mockedSigsClientInterface.DeleteAllOfCalls())
func (mock *SigsClientInterfaceMock) DeleteAllOfCalls() []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteAllOfOption
} {
var calls []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.DeleteAllOfOption
}
mock.lockDeleteAllOf.RLock()
calls = mock.calls.DeleteAllOf
mock.lockDeleteAllOf.RUnlock()
return calls
}
// Get calls GetFunc.
func (mock *SigsClientInterfaceMock) Get(ctx context.Context, key types.NamespacedName, obj k8sclient.Object) error {
if mock.GetFunc == nil {
panic("SigsClientInterfaceMock.GetFunc: method is nil but SigsClientInterface.Get was just called")
}
callInfo := struct {
Ctx context.Context
Key types.NamespacedName
Obj k8sclient.Object
}{
Ctx: ctx,
Key: key,
Obj: obj,
}
mock.lockGet.Lock()
mock.calls.Get = append(mock.calls.Get, callInfo)
mock.lockGet.Unlock()
return mock.GetFunc(ctx, key, obj)
}
// GetCalls gets all the calls that were made to Get.
// Check the length with:
//
// len(mockedSigsClientInterface.GetCalls())
func (mock *SigsClientInterfaceMock) GetCalls() []struct {
Ctx context.Context
Key types.NamespacedName
Obj k8sclient.Object
} {
var calls []struct {
Ctx context.Context
Key types.NamespacedName
Obj k8sclient.Object
}
mock.lockGet.RLock()
calls = mock.calls.Get
mock.lockGet.RUnlock()
return calls
}
// GetSigsClient calls GetSigsClientFunc.
func (mock *SigsClientInterfaceMock) GetSigsClient() k8sclient.Client {
if mock.GetSigsClientFunc == nil {
panic("SigsClientInterfaceMock.GetSigsClientFunc: method is nil but SigsClientInterface.GetSigsClient was just called")
}
callInfo := struct {
}{}
mock.lockGetSigsClient.Lock()
mock.calls.GetSigsClient = append(mock.calls.GetSigsClient, callInfo)
mock.lockGetSigsClient.Unlock()
return mock.GetSigsClientFunc()
}
// GetSigsClientCalls gets all the calls that were made to GetSigsClient.
// Check the length with:
//
// len(mockedSigsClientInterface.GetSigsClientCalls())
func (mock *SigsClientInterfaceMock) GetSigsClientCalls() []struct {
} {
var calls []struct {
}
mock.lockGetSigsClient.RLock()
calls = mock.calls.GetSigsClient
mock.lockGetSigsClient.RUnlock()
return calls
}
// List calls ListFunc.
func (mock *SigsClientInterfaceMock) List(ctx context.Context, list k8sclient.ObjectList, opts ...k8sclient.ListOption) error {
if mock.ListFunc == nil {
panic("SigsClientInterfaceMock.ListFunc: method is nil but SigsClientInterface.List was just called")
}
callInfo := struct {
Ctx context.Context
List k8sclient.ObjectList
Opts []k8sclient.ListOption
}{
Ctx: ctx,
List: list,
Opts: opts,
}
mock.lockList.Lock()
mock.calls.List = append(mock.calls.List, callInfo)
mock.lockList.Unlock()
return mock.ListFunc(ctx, list, opts...)
}
// ListCalls gets all the calls that were made to List.
// Check the length with:
//
// len(mockedSigsClientInterface.ListCalls())
func (mock *SigsClientInterfaceMock) ListCalls() []struct {
Ctx context.Context
List k8sclient.ObjectList
Opts []k8sclient.ListOption
} {
var calls []struct {
Ctx context.Context
List k8sclient.ObjectList
Opts []k8sclient.ListOption
}
mock.lockList.RLock()
calls = mock.calls.List
mock.lockList.RUnlock()
return calls
}
// Patch calls PatchFunc.
func (mock *SigsClientInterfaceMock) Patch(ctx context.Context, obj k8sclient.Object, patch k8sclient.Patch, opts ...k8sclient.PatchOption) error {
if mock.PatchFunc == nil {
panic("SigsClientInterfaceMock.PatchFunc: method is nil but SigsClientInterface.Patch was just called")
}
callInfo := struct {
Ctx context.Context
Obj k8sclient.Object
Patch k8sclient.Patch
Opts []k8sclient.PatchOption
}{
Ctx: ctx,
Obj: obj,
Patch: patch,
Opts: opts,
}
mock.lockPatch.Lock()
mock.calls.Patch = append(mock.calls.Patch, callInfo)
mock.lockPatch.Unlock()
return mock.PatchFunc(ctx, obj, patch, opts...)
}
// PatchCalls gets all the calls that were made to Patch.
// Check the length with:
//
// len(mockedSigsClientInterface.PatchCalls())
func (mock *SigsClientInterfaceMock) PatchCalls() []struct {
Ctx context.Context
Obj k8sclient.Object
Patch k8sclient.Patch
Opts []k8sclient.PatchOption
} {
var calls []struct {
Ctx context.Context
Obj k8sclient.Object
Patch k8sclient.Patch
Opts []k8sclient.PatchOption
}
mock.lockPatch.RLock()
calls = mock.calls.Patch
mock.lockPatch.RUnlock()
return calls
}
// RESTMapper calls RESTMapperFunc.
func (mock *SigsClientInterfaceMock) RESTMapper() meta.RESTMapper {
if mock.RESTMapperFunc == nil {
panic("SigsClientInterfaceMock.RESTMapperFunc: method is nil but SigsClientInterface.RESTMapper was just called")
}
callInfo := struct {
}{}
mock.lockRESTMapper.Lock()
mock.calls.RESTMapper = append(mock.calls.RESTMapper, callInfo)
mock.lockRESTMapper.Unlock()
return mock.RESTMapperFunc()
}
// RESTMapperCalls gets all the calls that were made to RESTMapper.
// Check the length with:
//
// len(mockedSigsClientInterface.RESTMapperCalls())
func (mock *SigsClientInterfaceMock) RESTMapperCalls() []struct {
} {
var calls []struct {
}
mock.lockRESTMapper.RLock()
calls = mock.calls.RESTMapper
mock.lockRESTMapper.RUnlock()
return calls
}
// Scheme calls SchemeFunc.
func (mock *SigsClientInterfaceMock) Scheme() *runtime.Scheme {
if mock.SchemeFunc == nil {
panic("SigsClientInterfaceMock.SchemeFunc: method is nil but SigsClientInterface.Scheme was just called")
}
callInfo := struct {
}{}
mock.lockScheme.Lock()
mock.calls.Scheme = append(mock.calls.Scheme, callInfo)
mock.lockScheme.Unlock()
return mock.SchemeFunc()
}
// SchemeCalls gets all the calls that were made to Scheme.
// Check the length with:
//
// len(mockedSigsClientInterface.SchemeCalls())
func (mock *SigsClientInterfaceMock) SchemeCalls() []struct {
} {
var calls []struct {
}
mock.lockScheme.RLock()
calls = mock.calls.Scheme
mock.lockScheme.RUnlock()
return calls
}
// Status calls StatusFunc.
func (mock *SigsClientInterfaceMock) Status() k8sclient.StatusWriter {
if mock.StatusFunc == nil {
panic("SigsClientInterfaceMock.StatusFunc: method is nil but SigsClientInterface.Status was just called")
}
callInfo := struct {
}{}
mock.lockStatus.Lock()
mock.calls.Status = append(mock.calls.Status, callInfo)
mock.lockStatus.Unlock()
return mock.StatusFunc()
}
// StatusCalls gets all the calls that were made to Status.
// Check the length with:
//
// len(mockedSigsClientInterface.StatusCalls())
func (mock *SigsClientInterfaceMock) StatusCalls() []struct {
} {
var calls []struct {
}
mock.lockStatus.RLock()
calls = mock.calls.Status
mock.lockStatus.RUnlock()
return calls
}
// Update calls UpdateFunc.
func (mock *SigsClientInterfaceMock) Update(ctx context.Context, obj k8sclient.Object, opts ...k8sclient.UpdateOption) error {
if mock.UpdateFunc == nil {
panic("SigsClientInterfaceMock.UpdateFunc: method is nil but SigsClientInterface.Update was just called")
}
callInfo := struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.UpdateOption
}{
Ctx: ctx,
Obj: obj,
Opts: opts,
}
mock.lockUpdate.Lock()
mock.calls.Update = append(mock.calls.Update, callInfo)
mock.lockUpdate.Unlock()
return mock.UpdateFunc(ctx, obj, opts...)
}
// UpdateCalls gets all the calls that were made to Update.
// Check the length with:
//
// len(mockedSigsClientInterface.UpdateCalls())
func (mock *SigsClientInterfaceMock) UpdateCalls() []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.UpdateOption
} {
var calls []struct {
Ctx context.Context
Obj k8sclient.Object
Opts []k8sclient.UpdateOption
}
mock.lockUpdate.RLock()
calls = mock.calls.Update
mock.lockUpdate.RUnlock()
return calls
}