-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkubernetes_namespaceable_resource_interface_mock.go
More file actions
4893 lines (3970 loc) · 236 KB
/
kubernetes_namespaceable_resource_interface_mock.go
File metadata and controls
4893 lines (3970 loc) · 236 KB
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
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by http://github.com/gojuno/minimock (v3.4.7). DO NOT EDIT.
package mock
//go:generate minimock -i k8s.io/client-go/dynamic.NamespaceableResourceInterface -o kubernetes_namespaceable_resource_interface_mock.go -n KubernetesNamespaceableResourceInterfaceMock -p mock
import (
"context"
"sync"
mm_atomic "sync/atomic"
mm_time "time"
"github.com/gojuno/minimock/v3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
mm_dynamic "k8s.io/client-go/dynamic"
)
// KubernetesNamespaceableResourceInterfaceMock implements mm_dynamic.NamespaceableResourceInterface
type KubernetesNamespaceableResourceInterfaceMock struct {
t minimock.Tester
finishOnce sync.Once
funcApply func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)
funcApplyOrigin string
inspectFuncApply func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string)
afterApplyCounter uint64
beforeApplyCounter uint64
ApplyMock mKubernetesNamespaceableResourceInterfaceMockApply
funcApplyStatus func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) (up1 *unstructured.Unstructured, err error)
funcApplyStatusOrigin string
inspectFuncApplyStatus func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions)
afterApplyStatusCounter uint64
beforeApplyStatusCounter uint64
ApplyStatusMock mKubernetesNamespaceableResourceInterfaceMockApplyStatus
funcCreate func(ctx context.Context, obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)
funcCreateOrigin string
inspectFuncCreate func(ctx context.Context, obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string)
afterCreateCounter uint64
beforeCreateCounter uint64
CreateMock mKubernetesNamespaceableResourceInterfaceMockCreate
funcDelete func(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string) (err error)
funcDeleteOrigin string
inspectFuncDelete func(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string)
afterDeleteCounter uint64
beforeDeleteCounter uint64
DeleteMock mKubernetesNamespaceableResourceInterfaceMockDelete
funcDeleteCollection func(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) (err error)
funcDeleteCollectionOrigin string
inspectFuncDeleteCollection func(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions)
afterDeleteCollectionCounter uint64
beforeDeleteCollectionCounter uint64
DeleteCollectionMock mKubernetesNamespaceableResourceInterfaceMockDeleteCollection
funcGet func(ctx context.Context, name string, options metav1.GetOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)
funcGetOrigin string
inspectFuncGet func(ctx context.Context, name string, options metav1.GetOptions, subresources ...string)
afterGetCounter uint64
beforeGetCounter uint64
GetMock mKubernetesNamespaceableResourceInterfaceMockGet
funcList func(ctx context.Context, opts metav1.ListOptions) (up1 *unstructured.UnstructuredList, err error)
funcListOrigin string
inspectFuncList func(ctx context.Context, opts metav1.ListOptions)
afterListCounter uint64
beforeListCounter uint64
ListMock mKubernetesNamespaceableResourceInterfaceMockList
funcNamespace func(s1 string) (r1 mm_dynamic.ResourceInterface)
funcNamespaceOrigin string
inspectFuncNamespace func(s1 string)
afterNamespaceCounter uint64
beforeNamespaceCounter uint64
NamespaceMock mKubernetesNamespaceableResourceInterfaceMockNamespace
funcPatch func(ctx context.Context, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)
funcPatchOrigin string
inspectFuncPatch func(ctx context.Context, name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string)
afterPatchCounter uint64
beforePatchCounter uint64
PatchMock mKubernetesNamespaceableResourceInterfaceMockPatch
funcUpdate func(ctx context.Context, obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)
funcUpdateOrigin string
inspectFuncUpdate func(ctx context.Context, obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string)
afterUpdateCounter uint64
beforeUpdateCounter uint64
UpdateMock mKubernetesNamespaceableResourceInterfaceMockUpdate
funcUpdateStatus func(ctx context.Context, obj *unstructured.Unstructured, options metav1.UpdateOptions) (up1 *unstructured.Unstructured, err error)
funcUpdateStatusOrigin string
inspectFuncUpdateStatus func(ctx context.Context, obj *unstructured.Unstructured, options metav1.UpdateOptions)
afterUpdateStatusCounter uint64
beforeUpdateStatusCounter uint64
UpdateStatusMock mKubernetesNamespaceableResourceInterfaceMockUpdateStatus
funcWatch func(ctx context.Context, opts metav1.ListOptions) (i1 watch.Interface, err error)
funcWatchOrigin string
inspectFuncWatch func(ctx context.Context, opts metav1.ListOptions)
afterWatchCounter uint64
beforeWatchCounter uint64
WatchMock mKubernetesNamespaceableResourceInterfaceMockWatch
}
// NewKubernetesNamespaceableResourceInterfaceMock returns a mock for mm_dynamic.NamespaceableResourceInterface
func NewKubernetesNamespaceableResourceInterfaceMock(t minimock.Tester) *KubernetesNamespaceableResourceInterfaceMock {
m := &KubernetesNamespaceableResourceInterfaceMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.ApplyMock = mKubernetesNamespaceableResourceInterfaceMockApply{mock: m}
m.ApplyMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockApplyParams{}
m.ApplyStatusMock = mKubernetesNamespaceableResourceInterfaceMockApplyStatus{mock: m}
m.ApplyStatusMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockApplyStatusParams{}
m.CreateMock = mKubernetesNamespaceableResourceInterfaceMockCreate{mock: m}
m.CreateMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockCreateParams{}
m.DeleteMock = mKubernetesNamespaceableResourceInterfaceMockDelete{mock: m}
m.DeleteMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockDeleteParams{}
m.DeleteCollectionMock = mKubernetesNamespaceableResourceInterfaceMockDeleteCollection{mock: m}
m.DeleteCollectionMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockDeleteCollectionParams{}
m.GetMock = mKubernetesNamespaceableResourceInterfaceMockGet{mock: m}
m.GetMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockGetParams{}
m.ListMock = mKubernetesNamespaceableResourceInterfaceMockList{mock: m}
m.ListMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockListParams{}
m.NamespaceMock = mKubernetesNamespaceableResourceInterfaceMockNamespace{mock: m}
m.NamespaceMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockNamespaceParams{}
m.PatchMock = mKubernetesNamespaceableResourceInterfaceMockPatch{mock: m}
m.PatchMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockPatchParams{}
m.UpdateMock = mKubernetesNamespaceableResourceInterfaceMockUpdate{mock: m}
m.UpdateMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockUpdateParams{}
m.UpdateStatusMock = mKubernetesNamespaceableResourceInterfaceMockUpdateStatus{mock: m}
m.UpdateStatusMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockUpdateStatusParams{}
m.WatchMock = mKubernetesNamespaceableResourceInterfaceMockWatch{mock: m}
m.WatchMock.callArgs = []*KubernetesNamespaceableResourceInterfaceMockWatchParams{}
t.Cleanup(m.MinimockFinish)
return m
}
type mKubernetesNamespaceableResourceInterfaceMockApply struct {
optional bool
mock *KubernetesNamespaceableResourceInterfaceMock
defaultExpectation *KubernetesNamespaceableResourceInterfaceMockApplyExpectation
expectations []*KubernetesNamespaceableResourceInterfaceMockApplyExpectation
callArgs []*KubernetesNamespaceableResourceInterfaceMockApplyParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// KubernetesNamespaceableResourceInterfaceMockApplyExpectation specifies expectation struct of the NamespaceableResourceInterface.Apply
type KubernetesNamespaceableResourceInterfaceMockApplyExpectation struct {
mock *KubernetesNamespaceableResourceInterfaceMock
params *KubernetesNamespaceableResourceInterfaceMockApplyParams
paramPtrs *KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs
expectationOrigins KubernetesNamespaceableResourceInterfaceMockApplyExpectationOrigins
results *KubernetesNamespaceableResourceInterfaceMockApplyResults
returnOrigin string
Counter uint64
}
// KubernetesNamespaceableResourceInterfaceMockApplyParams contains parameters of the NamespaceableResourceInterface.Apply
type KubernetesNamespaceableResourceInterfaceMockApplyParams struct {
ctx context.Context
name string
obj *unstructured.Unstructured
options metav1.ApplyOptions
subresources []string
}
// KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs contains pointers to parameters of the NamespaceableResourceInterface.Apply
type KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs struct {
ctx *context.Context
name *string
obj **unstructured.Unstructured
options *metav1.ApplyOptions
subresources *[]string
}
// KubernetesNamespaceableResourceInterfaceMockApplyResults contains results of the NamespaceableResourceInterface.Apply
type KubernetesNamespaceableResourceInterfaceMockApplyResults struct {
up1 *unstructured.Unstructured
err error
}
// KubernetesNamespaceableResourceInterfaceMockApplyOrigins contains origins of expectations of the NamespaceableResourceInterface.Apply
type KubernetesNamespaceableResourceInterfaceMockApplyExpectationOrigins struct {
origin string
originCtx string
originName string
originObj string
originOptions string
originSubresources string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Optional() *mKubernetesNamespaceableResourceInterfaceMockApply {
mmApply.optional = true
return mmApply
}
// Expect sets up expected params for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Expect(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.paramPtrs != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by ExpectParams functions")
}
mmApply.defaultExpectation.params = &KubernetesNamespaceableResourceInterfaceMockApplyParams{ctx, name, obj, options, subresources}
mmApply.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmApply.expectations {
if minimock.Equal(e.params, mmApply.defaultExpectation.params) {
mmApply.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmApply.defaultExpectation.params)
}
}
return mmApply
}
// ExpectCtxParam1 sets up expected param ctx for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) ExpectCtxParam1(ctx context.Context) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.params != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Expect")
}
if mmApply.defaultExpectation.paramPtrs == nil {
mmApply.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs{}
}
mmApply.defaultExpectation.paramPtrs.ctx = &ctx
mmApply.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmApply
}
// ExpectNameParam2 sets up expected param name for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) ExpectNameParam2(name string) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.params != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Expect")
}
if mmApply.defaultExpectation.paramPtrs == nil {
mmApply.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs{}
}
mmApply.defaultExpectation.paramPtrs.name = &name
mmApply.defaultExpectation.expectationOrigins.originName = minimock.CallerInfo(1)
return mmApply
}
// ExpectObjParam3 sets up expected param obj for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) ExpectObjParam3(obj *unstructured.Unstructured) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.params != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Expect")
}
if mmApply.defaultExpectation.paramPtrs == nil {
mmApply.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs{}
}
mmApply.defaultExpectation.paramPtrs.obj = &obj
mmApply.defaultExpectation.expectationOrigins.originObj = minimock.CallerInfo(1)
return mmApply
}
// ExpectOptionsParam4 sets up expected param options for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) ExpectOptionsParam4(options metav1.ApplyOptions) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.params != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Expect")
}
if mmApply.defaultExpectation.paramPtrs == nil {
mmApply.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs{}
}
mmApply.defaultExpectation.paramPtrs.options = &options
mmApply.defaultExpectation.expectationOrigins.originOptions = minimock.CallerInfo(1)
return mmApply
}
// ExpectSubresourcesParam5 sets up expected param subresources for NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) ExpectSubresourcesParam5(subresources ...string) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{}
}
if mmApply.defaultExpectation.params != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Expect")
}
if mmApply.defaultExpectation.paramPtrs == nil {
mmApply.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyParamPtrs{}
}
mmApply.defaultExpectation.paramPtrs.subresources = &subresources
mmApply.defaultExpectation.expectationOrigins.originSubresources = minimock.CallerInfo(1)
return mmApply
}
// Inspect accepts an inspector function that has same arguments as the NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Inspect(f func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string)) *mKubernetesNamespaceableResourceInterfaceMockApply {
if mmApply.mock.inspectFuncApply != nil {
mmApply.mock.t.Fatalf("Inspect function is already set for KubernetesNamespaceableResourceInterfaceMock.Apply")
}
mmApply.mock.inspectFuncApply = f
return mmApply
}
// Return sets up results that will be returned by NamespaceableResourceInterface.Apply
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Return(up1 *unstructured.Unstructured, err error) *KubernetesNamespaceableResourceInterfaceMock {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
if mmApply.defaultExpectation == nil {
mmApply.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{mock: mmApply.mock}
}
mmApply.defaultExpectation.results = &KubernetesNamespaceableResourceInterfaceMockApplyResults{up1, err}
mmApply.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmApply.mock
}
// Set uses given function f to mock the NamespaceableResourceInterface.Apply method
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Set(f func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) (up1 *unstructured.Unstructured, err error)) *KubernetesNamespaceableResourceInterfaceMock {
if mmApply.defaultExpectation != nil {
mmApply.mock.t.Fatalf("Default expectation is already set for the NamespaceableResourceInterface.Apply method")
}
if len(mmApply.expectations) > 0 {
mmApply.mock.t.Fatalf("Some expectations are already set for the NamespaceableResourceInterface.Apply method")
}
mmApply.mock.funcApply = f
mmApply.mock.funcApplyOrigin = minimock.CallerInfo(1)
return mmApply.mock
}
// When sets expectation for the NamespaceableResourceInterface.Apply which will trigger the result defined by the following
// Then helper
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) When(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) *KubernetesNamespaceableResourceInterfaceMockApplyExpectation {
if mmApply.mock.funcApply != nil {
mmApply.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.Apply mock is already set by Set")
}
expectation := &KubernetesNamespaceableResourceInterfaceMockApplyExpectation{
mock: mmApply.mock,
params: &KubernetesNamespaceableResourceInterfaceMockApplyParams{ctx, name, obj, options, subresources},
expectationOrigins: KubernetesNamespaceableResourceInterfaceMockApplyExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmApply.expectations = append(mmApply.expectations, expectation)
return expectation
}
// Then sets up NamespaceableResourceInterface.Apply return parameters for the expectation previously defined by the When method
func (e *KubernetesNamespaceableResourceInterfaceMockApplyExpectation) Then(up1 *unstructured.Unstructured, err error) *KubernetesNamespaceableResourceInterfaceMock {
e.results = &KubernetesNamespaceableResourceInterfaceMockApplyResults{up1, err}
return e.mock
}
// Times sets number of times NamespaceableResourceInterface.Apply should be invoked
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Times(n uint64) *mKubernetesNamespaceableResourceInterfaceMockApply {
if n == 0 {
mmApply.mock.t.Fatalf("Times of KubernetesNamespaceableResourceInterfaceMock.Apply mock can not be zero")
}
mm_atomic.StoreUint64(&mmApply.expectedInvocations, n)
mmApply.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmApply
}
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) invocationsDone() bool {
if len(mmApply.expectations) == 0 && mmApply.defaultExpectation == nil && mmApply.mock.funcApply == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmApply.mock.afterApplyCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmApply.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// Apply implements mm_dynamic.NamespaceableResourceInterface
func (mmApply *KubernetesNamespaceableResourceInterfaceMock) Apply(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions, subresources ...string) (up1 *unstructured.Unstructured, err error) {
mm_atomic.AddUint64(&mmApply.beforeApplyCounter, 1)
defer mm_atomic.AddUint64(&mmApply.afterApplyCounter, 1)
mmApply.t.Helper()
if mmApply.inspectFuncApply != nil {
mmApply.inspectFuncApply(ctx, name, obj, options, subresources...)
}
mm_params := KubernetesNamespaceableResourceInterfaceMockApplyParams{ctx, name, obj, options, subresources}
// Record call args
mmApply.ApplyMock.mutex.Lock()
mmApply.ApplyMock.callArgs = append(mmApply.ApplyMock.callArgs, &mm_params)
mmApply.ApplyMock.mutex.Unlock()
for _, e := range mmApply.ApplyMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.up1, e.results.err
}
}
if mmApply.ApplyMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmApply.ApplyMock.defaultExpectation.Counter, 1)
mm_want := mmApply.ApplyMock.defaultExpectation.params
mm_want_ptrs := mmApply.ApplyMock.defaultExpectation.paramPtrs
mm_got := KubernetesNamespaceableResourceInterfaceMockApplyParams{ctx, name, obj, options, subresources}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.name != nil && !minimock.Equal(*mm_want_ptrs.name, mm_got.name) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameter name, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.originName, *mm_want_ptrs.name, mm_got.name, minimock.Diff(*mm_want_ptrs.name, mm_got.name))
}
if mm_want_ptrs.obj != nil && !minimock.Equal(*mm_want_ptrs.obj, mm_got.obj) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameter obj, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.originObj, *mm_want_ptrs.obj, mm_got.obj, minimock.Diff(*mm_want_ptrs.obj, mm_got.obj))
}
if mm_want_ptrs.options != nil && !minimock.Equal(*mm_want_ptrs.options, mm_got.options) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameter options, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.originOptions, *mm_want_ptrs.options, mm_got.options, minimock.Diff(*mm_want_ptrs.options, mm_got.options))
}
if mm_want_ptrs.subresources != nil && !minimock.Equal(*mm_want_ptrs.subresources, mm_got.subresources) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameter subresources, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.originSubresources, *mm_want_ptrs.subresources, mm_got.subresources, minimock.Diff(*mm_want_ptrs.subresources, mm_got.subresources))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmApply.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.Apply got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApply.ApplyMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmApply.ApplyMock.defaultExpectation.results
if mm_results == nil {
mmApply.t.Fatal("No results are set for the KubernetesNamespaceableResourceInterfaceMock.Apply")
}
return (*mm_results).up1, (*mm_results).err
}
if mmApply.funcApply != nil {
return mmApply.funcApply(ctx, name, obj, options, subresources...)
}
mmApply.t.Fatalf("Unexpected call to KubernetesNamespaceableResourceInterfaceMock.Apply. %v %v %v %v %v", ctx, name, obj, options, subresources)
return
}
// ApplyAfterCounter returns a count of finished KubernetesNamespaceableResourceInterfaceMock.Apply invocations
func (mmApply *KubernetesNamespaceableResourceInterfaceMock) ApplyAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmApply.afterApplyCounter)
}
// ApplyBeforeCounter returns a count of KubernetesNamespaceableResourceInterfaceMock.Apply invocations
func (mmApply *KubernetesNamespaceableResourceInterfaceMock) ApplyBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmApply.beforeApplyCounter)
}
// Calls returns a list of arguments used in each call to KubernetesNamespaceableResourceInterfaceMock.Apply.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmApply *mKubernetesNamespaceableResourceInterfaceMockApply) Calls() []*KubernetesNamespaceableResourceInterfaceMockApplyParams {
mmApply.mutex.RLock()
argCopy := make([]*KubernetesNamespaceableResourceInterfaceMockApplyParams, len(mmApply.callArgs))
copy(argCopy, mmApply.callArgs)
mmApply.mutex.RUnlock()
return argCopy
}
// MinimockApplyDone returns true if the count of the Apply invocations corresponds
// the number of defined expectations
func (m *KubernetesNamespaceableResourceInterfaceMock) MinimockApplyDone() bool {
if m.ApplyMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.ApplyMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.ApplyMock.invocationsDone()
}
// MinimockApplyInspect logs each unmet expectation
func (m *KubernetesNamespaceableResourceInterfaceMock) MinimockApplyInspect() {
for _, e := range m.ApplyMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.Apply at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterApplyCounter := mm_atomic.LoadUint64(&m.afterApplyCounter)
// if default expectation was set then invocations count should be greater than zero
if m.ApplyMock.defaultExpectation != nil && afterApplyCounter < 1 {
if m.ApplyMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.Apply at\n%s", m.ApplyMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.Apply at\n%s with params: %#v", m.ApplyMock.defaultExpectation.expectationOrigins.origin, *m.ApplyMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcApply != nil && afterApplyCounter < 1 {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.Apply at\n%s", m.funcApplyOrigin)
}
if !m.ApplyMock.invocationsDone() && afterApplyCounter > 0 {
m.t.Errorf("Expected %d calls to KubernetesNamespaceableResourceInterfaceMock.Apply at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.ApplyMock.expectedInvocations), m.ApplyMock.expectedInvocationsOrigin, afterApplyCounter)
}
}
type mKubernetesNamespaceableResourceInterfaceMockApplyStatus struct {
optional bool
mock *KubernetesNamespaceableResourceInterfaceMock
defaultExpectation *KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation
expectations []*KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation
callArgs []*KubernetesNamespaceableResourceInterfaceMockApplyStatusParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation specifies expectation struct of the NamespaceableResourceInterface.ApplyStatus
type KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation struct {
mock *KubernetesNamespaceableResourceInterfaceMock
params *KubernetesNamespaceableResourceInterfaceMockApplyStatusParams
paramPtrs *KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs
expectationOrigins KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectationOrigins
results *KubernetesNamespaceableResourceInterfaceMockApplyStatusResults
returnOrigin string
Counter uint64
}
// KubernetesNamespaceableResourceInterfaceMockApplyStatusParams contains parameters of the NamespaceableResourceInterface.ApplyStatus
type KubernetesNamespaceableResourceInterfaceMockApplyStatusParams struct {
ctx context.Context
name string
obj *unstructured.Unstructured
options metav1.ApplyOptions
}
// KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs contains pointers to parameters of the NamespaceableResourceInterface.ApplyStatus
type KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs struct {
ctx *context.Context
name *string
obj **unstructured.Unstructured
options *metav1.ApplyOptions
}
// KubernetesNamespaceableResourceInterfaceMockApplyStatusResults contains results of the NamespaceableResourceInterface.ApplyStatus
type KubernetesNamespaceableResourceInterfaceMockApplyStatusResults struct {
up1 *unstructured.Unstructured
err error
}
// KubernetesNamespaceableResourceInterfaceMockApplyStatusOrigins contains origins of expectations of the NamespaceableResourceInterface.ApplyStatus
type KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectationOrigins struct {
origin string
originCtx string
originName string
originObj string
originOptions string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Optional() *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
mmApplyStatus.optional = true
return mmApplyStatus
}
// Expect sets up expected params for NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Expect(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{}
}
if mmApplyStatus.defaultExpectation.paramPtrs != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by ExpectParams functions")
}
mmApplyStatus.defaultExpectation.params = &KubernetesNamespaceableResourceInterfaceMockApplyStatusParams{ctx, name, obj, options}
mmApplyStatus.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmApplyStatus.expectations {
if minimock.Equal(e.params, mmApplyStatus.defaultExpectation.params) {
mmApplyStatus.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmApplyStatus.defaultExpectation.params)
}
}
return mmApplyStatus
}
// ExpectCtxParam1 sets up expected param ctx for NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) ExpectCtxParam1(ctx context.Context) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{}
}
if mmApplyStatus.defaultExpectation.params != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Expect")
}
if mmApplyStatus.defaultExpectation.paramPtrs == nil {
mmApplyStatus.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs{}
}
mmApplyStatus.defaultExpectation.paramPtrs.ctx = &ctx
mmApplyStatus.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmApplyStatus
}
// ExpectNameParam2 sets up expected param name for NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) ExpectNameParam2(name string) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{}
}
if mmApplyStatus.defaultExpectation.params != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Expect")
}
if mmApplyStatus.defaultExpectation.paramPtrs == nil {
mmApplyStatus.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs{}
}
mmApplyStatus.defaultExpectation.paramPtrs.name = &name
mmApplyStatus.defaultExpectation.expectationOrigins.originName = minimock.CallerInfo(1)
return mmApplyStatus
}
// ExpectObjParam3 sets up expected param obj for NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) ExpectObjParam3(obj *unstructured.Unstructured) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{}
}
if mmApplyStatus.defaultExpectation.params != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Expect")
}
if mmApplyStatus.defaultExpectation.paramPtrs == nil {
mmApplyStatus.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs{}
}
mmApplyStatus.defaultExpectation.paramPtrs.obj = &obj
mmApplyStatus.defaultExpectation.expectationOrigins.originObj = minimock.CallerInfo(1)
return mmApplyStatus
}
// ExpectOptionsParam4 sets up expected param options for NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) ExpectOptionsParam4(options metav1.ApplyOptions) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{}
}
if mmApplyStatus.defaultExpectation.params != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Expect")
}
if mmApplyStatus.defaultExpectation.paramPtrs == nil {
mmApplyStatus.defaultExpectation.paramPtrs = &KubernetesNamespaceableResourceInterfaceMockApplyStatusParamPtrs{}
}
mmApplyStatus.defaultExpectation.paramPtrs.options = &options
mmApplyStatus.defaultExpectation.expectationOrigins.originOptions = minimock.CallerInfo(1)
return mmApplyStatus
}
// Inspect accepts an inspector function that has same arguments as the NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Inspect(f func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions)) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if mmApplyStatus.mock.inspectFuncApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("Inspect function is already set for KubernetesNamespaceableResourceInterfaceMock.ApplyStatus")
}
mmApplyStatus.mock.inspectFuncApplyStatus = f
return mmApplyStatus
}
// Return sets up results that will be returned by NamespaceableResourceInterface.ApplyStatus
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Return(up1 *unstructured.Unstructured, err error) *KubernetesNamespaceableResourceInterfaceMock {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
if mmApplyStatus.defaultExpectation == nil {
mmApplyStatus.defaultExpectation = &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{mock: mmApplyStatus.mock}
}
mmApplyStatus.defaultExpectation.results = &KubernetesNamespaceableResourceInterfaceMockApplyStatusResults{up1, err}
mmApplyStatus.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmApplyStatus.mock
}
// Set uses given function f to mock the NamespaceableResourceInterface.ApplyStatus method
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Set(f func(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) (up1 *unstructured.Unstructured, err error)) *KubernetesNamespaceableResourceInterfaceMock {
if mmApplyStatus.defaultExpectation != nil {
mmApplyStatus.mock.t.Fatalf("Default expectation is already set for the NamespaceableResourceInterface.ApplyStatus method")
}
if len(mmApplyStatus.expectations) > 0 {
mmApplyStatus.mock.t.Fatalf("Some expectations are already set for the NamespaceableResourceInterface.ApplyStatus method")
}
mmApplyStatus.mock.funcApplyStatus = f
mmApplyStatus.mock.funcApplyStatusOrigin = minimock.CallerInfo(1)
return mmApplyStatus.mock
}
// When sets expectation for the NamespaceableResourceInterface.ApplyStatus which will trigger the result defined by the following
// Then helper
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) When(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) *KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation {
if mmApplyStatus.mock.funcApplyStatus != nil {
mmApplyStatus.mock.t.Fatalf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock is already set by Set")
}
expectation := &KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation{
mock: mmApplyStatus.mock,
params: &KubernetesNamespaceableResourceInterfaceMockApplyStatusParams{ctx, name, obj, options},
expectationOrigins: KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmApplyStatus.expectations = append(mmApplyStatus.expectations, expectation)
return expectation
}
// Then sets up NamespaceableResourceInterface.ApplyStatus return parameters for the expectation previously defined by the When method
func (e *KubernetesNamespaceableResourceInterfaceMockApplyStatusExpectation) Then(up1 *unstructured.Unstructured, err error) *KubernetesNamespaceableResourceInterfaceMock {
e.results = &KubernetesNamespaceableResourceInterfaceMockApplyStatusResults{up1, err}
return e.mock
}
// Times sets number of times NamespaceableResourceInterface.ApplyStatus should be invoked
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Times(n uint64) *mKubernetesNamespaceableResourceInterfaceMockApplyStatus {
if n == 0 {
mmApplyStatus.mock.t.Fatalf("Times of KubernetesNamespaceableResourceInterfaceMock.ApplyStatus mock can not be zero")
}
mm_atomic.StoreUint64(&mmApplyStatus.expectedInvocations, n)
mmApplyStatus.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmApplyStatus
}
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) invocationsDone() bool {
if len(mmApplyStatus.expectations) == 0 && mmApplyStatus.defaultExpectation == nil && mmApplyStatus.mock.funcApplyStatus == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmApplyStatus.mock.afterApplyStatusCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmApplyStatus.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// ApplyStatus implements mm_dynamic.NamespaceableResourceInterface
func (mmApplyStatus *KubernetesNamespaceableResourceInterfaceMock) ApplyStatus(ctx context.Context, name string, obj *unstructured.Unstructured, options metav1.ApplyOptions) (up1 *unstructured.Unstructured, err error) {
mm_atomic.AddUint64(&mmApplyStatus.beforeApplyStatusCounter, 1)
defer mm_atomic.AddUint64(&mmApplyStatus.afterApplyStatusCounter, 1)
mmApplyStatus.t.Helper()
if mmApplyStatus.inspectFuncApplyStatus != nil {
mmApplyStatus.inspectFuncApplyStatus(ctx, name, obj, options)
}
mm_params := KubernetesNamespaceableResourceInterfaceMockApplyStatusParams{ctx, name, obj, options}
// Record call args
mmApplyStatus.ApplyStatusMock.mutex.Lock()
mmApplyStatus.ApplyStatusMock.callArgs = append(mmApplyStatus.ApplyStatusMock.callArgs, &mm_params)
mmApplyStatus.ApplyStatusMock.mutex.Unlock()
for _, e := range mmApplyStatus.ApplyStatusMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.up1, e.results.err
}
}
if mmApplyStatus.ApplyStatusMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmApplyStatus.ApplyStatusMock.defaultExpectation.Counter, 1)
mm_want := mmApplyStatus.ApplyStatusMock.defaultExpectation.params
mm_want_ptrs := mmApplyStatus.ApplyStatusMock.defaultExpectation.paramPtrs
mm_got := KubernetesNamespaceableResourceInterfaceMockApplyStatusParams{ctx, name, obj, options}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmApplyStatus.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApplyStatus.ApplyStatusMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.name != nil && !minimock.Equal(*mm_want_ptrs.name, mm_got.name) {
mmApplyStatus.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus got unexpected parameter name, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApplyStatus.ApplyStatusMock.defaultExpectation.expectationOrigins.originName, *mm_want_ptrs.name, mm_got.name, minimock.Diff(*mm_want_ptrs.name, mm_got.name))
}
if mm_want_ptrs.obj != nil && !minimock.Equal(*mm_want_ptrs.obj, mm_got.obj) {
mmApplyStatus.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus got unexpected parameter obj, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApplyStatus.ApplyStatusMock.defaultExpectation.expectationOrigins.originObj, *mm_want_ptrs.obj, mm_got.obj, minimock.Diff(*mm_want_ptrs.obj, mm_got.obj))
}
if mm_want_ptrs.options != nil && !minimock.Equal(*mm_want_ptrs.options, mm_got.options) {
mmApplyStatus.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus got unexpected parameter options, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApplyStatus.ApplyStatusMock.defaultExpectation.expectationOrigins.originOptions, *mm_want_ptrs.options, mm_got.options, minimock.Diff(*mm_want_ptrs.options, mm_got.options))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmApplyStatus.t.Errorf("KubernetesNamespaceableResourceInterfaceMock.ApplyStatus got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApplyStatus.ApplyStatusMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmApplyStatus.ApplyStatusMock.defaultExpectation.results
if mm_results == nil {
mmApplyStatus.t.Fatal("No results are set for the KubernetesNamespaceableResourceInterfaceMock.ApplyStatus")
}
return (*mm_results).up1, (*mm_results).err
}
if mmApplyStatus.funcApplyStatus != nil {
return mmApplyStatus.funcApplyStatus(ctx, name, obj, options)
}
mmApplyStatus.t.Fatalf("Unexpected call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus. %v %v %v %v", ctx, name, obj, options)
return
}
// ApplyStatusAfterCounter returns a count of finished KubernetesNamespaceableResourceInterfaceMock.ApplyStatus invocations
func (mmApplyStatus *KubernetesNamespaceableResourceInterfaceMock) ApplyStatusAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmApplyStatus.afterApplyStatusCounter)
}
// ApplyStatusBeforeCounter returns a count of KubernetesNamespaceableResourceInterfaceMock.ApplyStatus invocations
func (mmApplyStatus *KubernetesNamespaceableResourceInterfaceMock) ApplyStatusBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmApplyStatus.beforeApplyStatusCounter)
}
// Calls returns a list of arguments used in each call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmApplyStatus *mKubernetesNamespaceableResourceInterfaceMockApplyStatus) Calls() []*KubernetesNamespaceableResourceInterfaceMockApplyStatusParams {
mmApplyStatus.mutex.RLock()
argCopy := make([]*KubernetesNamespaceableResourceInterfaceMockApplyStatusParams, len(mmApplyStatus.callArgs))
copy(argCopy, mmApplyStatus.callArgs)
mmApplyStatus.mutex.RUnlock()
return argCopy
}
// MinimockApplyStatusDone returns true if the count of the ApplyStatus invocations corresponds
// the number of defined expectations
func (m *KubernetesNamespaceableResourceInterfaceMock) MinimockApplyStatusDone() bool {
if m.ApplyStatusMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.ApplyStatusMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.ApplyStatusMock.invocationsDone()
}
// MinimockApplyStatusInspect logs each unmet expectation
func (m *KubernetesNamespaceableResourceInterfaceMock) MinimockApplyStatusInspect() {
for _, e := range m.ApplyStatusMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterApplyStatusCounter := mm_atomic.LoadUint64(&m.afterApplyStatusCounter)
// if default expectation was set then invocations count should be greater than zero
if m.ApplyStatusMock.defaultExpectation != nil && afterApplyStatusCounter < 1 {
if m.ApplyStatusMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus at\n%s", m.ApplyStatusMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus at\n%s with params: %#v", m.ApplyStatusMock.defaultExpectation.expectationOrigins.origin, *m.ApplyStatusMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcApplyStatus != nil && afterApplyStatusCounter < 1 {
m.t.Errorf("Expected call to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus at\n%s", m.funcApplyStatusOrigin)
}
if !m.ApplyStatusMock.invocationsDone() && afterApplyStatusCounter > 0 {
m.t.Errorf("Expected %d calls to KubernetesNamespaceableResourceInterfaceMock.ApplyStatus at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.ApplyStatusMock.expectedInvocations), m.ApplyStatusMock.expectedInvocationsOrigin, afterApplyStatusCounter)
}
}