-
Notifications
You must be signed in to change notification settings - Fork 123
/
Index.go
837 lines (693 loc) · 22.5 KB
/
Index.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
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
// Copyright 2021-2023 Zenauth Ltd.
// SPDX-License-Identifier: Apache-2.0
// Code generated by mockery v2.32.4. DO NOT EDIT.
package mocks
import (
context "context"
io "io"
index "github.com/cerbos/cerbos/internal/storage/index"
mock "github.com/stretchr/testify/mock"
namer "github.com/cerbos/cerbos/internal/namer"
policy "github.com/cerbos/cerbos/internal/policy"
storage "github.com/cerbos/cerbos/internal/storage"
)
// Index is an autogenerated mock type for the Index type
type Index struct {
mock.Mock
}
type Index_Expecter struct {
mock *mock.Mock
}
func (_m *Index) EXPECT() *Index_Expecter {
return &Index_Expecter{mock: &_m.Mock}
}
// AddOrUpdate provides a mock function with given fields: _a0
func (_m *Index) AddOrUpdate(_a0 index.Entry) (storage.Event, error) {
ret := _m.Called(_a0)
var r0 storage.Event
var r1 error
if rf, ok := ret.Get(0).(func(index.Entry) (storage.Event, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(index.Entry) storage.Event); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(storage.Event)
}
if rf, ok := ret.Get(1).(func(index.Entry) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_AddOrUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddOrUpdate'
type Index_AddOrUpdate_Call struct {
*mock.Call
}
// AddOrUpdate is a helper method to define mock.On call
// - _a0 index.Entry
func (_e *Index_Expecter) AddOrUpdate(_a0 interface{}) *Index_AddOrUpdate_Call {
return &Index_AddOrUpdate_Call{Call: _e.mock.On("AddOrUpdate", _a0)}
}
func (_c *Index_AddOrUpdate_Call) Run(run func(_a0 index.Entry)) *Index_AddOrUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(index.Entry))
})
return _c
}
func (_c *Index_AddOrUpdate_Call) Return(_a0 storage.Event, _a1 error) *Index_AddOrUpdate_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_AddOrUpdate_Call) RunAndReturn(run func(index.Entry) (storage.Event, error)) *Index_AddOrUpdate_Call {
_c.Call.Return(run)
return _c
}
// Clear provides a mock function with given fields:
func (_m *Index) Clear() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Index_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear'
type Index_Clear_Call struct {
*mock.Call
}
// Clear is a helper method to define mock.On call
func (_e *Index_Expecter) Clear() *Index_Clear_Call {
return &Index_Clear_Call{Call: _e.mock.On("Clear")}
}
func (_c *Index_Clear_Call) Run(run func()) *Index_Clear_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Index_Clear_Call) Return(_a0 error) *Index_Clear_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Index_Clear_Call) RunAndReturn(run func() error) *Index_Clear_Call {
_c.Call.Return(run)
return _c
}
// Close provides a mock function with given fields:
func (_m *Index) Close() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Index_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type Index_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *Index_Expecter) Close() *Index_Close_Call {
return &Index_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *Index_Close_Call) Run(run func()) *Index_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Index_Close_Call) Return(_a0 error) *Index_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Index_Close_Call) RunAndReturn(run func() error) *Index_Close_Call {
_c.Call.Return(run)
return _c
}
// Delete provides a mock function with given fields: _a0
func (_m *Index) Delete(_a0 index.Entry) (storage.Event, error) {
ret := _m.Called(_a0)
var r0 storage.Event
var r1 error
if rf, ok := ret.Get(0).(func(index.Entry) (storage.Event, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(index.Entry) storage.Event); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(storage.Event)
}
if rf, ok := ret.Get(1).(func(index.Entry) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type Index_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - _a0 index.Entry
func (_e *Index_Expecter) Delete(_a0 interface{}) *Index_Delete_Call {
return &Index_Delete_Call{Call: _e.mock.On("Delete", _a0)}
}
func (_c *Index_Delete_Call) Run(run func(_a0 index.Entry)) *Index_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(index.Entry))
})
return _c
}
func (_c *Index_Delete_Call) Return(_a0 storage.Event, _a1 error) *Index_Delete_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_Delete_Call) RunAndReturn(run func(index.Entry) (storage.Event, error)) *Index_Delete_Call {
_c.Call.Return(run)
return _c
}
// GetAllCompilationUnits provides a mock function with given fields: _a0
func (_m *Index) GetAllCompilationUnits(_a0 context.Context) <-chan *policy.CompilationUnit {
ret := _m.Called(_a0)
var r0 <-chan *policy.CompilationUnit
if rf, ok := ret.Get(0).(func(context.Context) <-chan *policy.CompilationUnit); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan *policy.CompilationUnit)
}
}
return r0
}
// Index_GetAllCompilationUnits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllCompilationUnits'
type Index_GetAllCompilationUnits_Call struct {
*mock.Call
}
// GetAllCompilationUnits is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Index_Expecter) GetAllCompilationUnits(_a0 interface{}) *Index_GetAllCompilationUnits_Call {
return &Index_GetAllCompilationUnits_Call{Call: _e.mock.On("GetAllCompilationUnits", _a0)}
}
func (_c *Index_GetAllCompilationUnits_Call) Run(run func(_a0 context.Context)) *Index_GetAllCompilationUnits_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Index_GetAllCompilationUnits_Call) Return(_a0 <-chan *policy.CompilationUnit) *Index_GetAllCompilationUnits_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Index_GetAllCompilationUnits_Call) RunAndReturn(run func(context.Context) <-chan *policy.CompilationUnit) *Index_GetAllCompilationUnits_Call {
_c.Call.Return(run)
return _c
}
// GetCompilationUnits provides a mock function with given fields: _a0
func (_m *Index) GetCompilationUnits(_a0 ...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error) {
_va := make([]interface{}, len(_a0))
for _i := range _a0 {
_va[_i] = _a0[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 map[namer.ModuleID]*policy.CompilationUnit
var r1 error
if rf, ok := ret.Get(0).(func(...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error)); ok {
return rf(_a0...)
}
if rf, ok := ret.Get(0).(func(...namer.ModuleID) map[namer.ModuleID]*policy.CompilationUnit); ok {
r0 = rf(_a0...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[namer.ModuleID]*policy.CompilationUnit)
}
}
if rf, ok := ret.Get(1).(func(...namer.ModuleID) error); ok {
r1 = rf(_a0...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_GetCompilationUnits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCompilationUnits'
type Index_GetCompilationUnits_Call struct {
*mock.Call
}
// GetCompilationUnits is a helper method to define mock.On call
// - _a0 ...namer.ModuleID
func (_e *Index_Expecter) GetCompilationUnits(_a0 ...interface{}) *Index_GetCompilationUnits_Call {
return &Index_GetCompilationUnits_Call{Call: _e.mock.On("GetCompilationUnits",
append([]interface{}{}, _a0...)...)}
}
func (_c *Index_GetCompilationUnits_Call) Run(run func(_a0 ...namer.ModuleID)) *Index_GetCompilationUnits_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]namer.ModuleID, len(args)-0)
for i, a := range args[0:] {
if a != nil {
variadicArgs[i] = a.(namer.ModuleID)
}
}
run(variadicArgs...)
})
return _c
}
func (_c *Index_GetCompilationUnits_Call) Return(_a0 map[namer.ModuleID]*policy.CompilationUnit, _a1 error) *Index_GetCompilationUnits_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_GetCompilationUnits_Call) RunAndReturn(run func(...namer.ModuleID) (map[namer.ModuleID]*policy.CompilationUnit, error)) *Index_GetCompilationUnits_Call {
_c.Call.Return(run)
return _c
}
// GetDependents provides a mock function with given fields: _a0
func (_m *Index) GetDependents(_a0 ...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error) {
_va := make([]interface{}, len(_a0))
for _i := range _a0 {
_va[_i] = _a0[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 map[namer.ModuleID][]namer.ModuleID
var r1 error
if rf, ok := ret.Get(0).(func(...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error)); ok {
return rf(_a0...)
}
if rf, ok := ret.Get(0).(func(...namer.ModuleID) map[namer.ModuleID][]namer.ModuleID); ok {
r0 = rf(_a0...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[namer.ModuleID][]namer.ModuleID)
}
}
if rf, ok := ret.Get(1).(func(...namer.ModuleID) error); ok {
r1 = rf(_a0...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_GetDependents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDependents'
type Index_GetDependents_Call struct {
*mock.Call
}
// GetDependents is a helper method to define mock.On call
// - _a0 ...namer.ModuleID
func (_e *Index_Expecter) GetDependents(_a0 ...interface{}) *Index_GetDependents_Call {
return &Index_GetDependents_Call{Call: _e.mock.On("GetDependents",
append([]interface{}{}, _a0...)...)}
}
func (_c *Index_GetDependents_Call) Run(run func(_a0 ...namer.ModuleID)) *Index_GetDependents_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]namer.ModuleID, len(args)-0)
for i, a := range args[0:] {
if a != nil {
variadicArgs[i] = a.(namer.ModuleID)
}
}
run(variadicArgs...)
})
return _c
}
func (_c *Index_GetDependents_Call) Return(_a0 map[namer.ModuleID][]namer.ModuleID, _a1 error) *Index_GetDependents_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_GetDependents_Call) RunAndReturn(run func(...namer.ModuleID) (map[namer.ModuleID][]namer.ModuleID, error)) *Index_GetDependents_Call {
_c.Call.Return(run)
return _c
}
// GetFiles provides a mock function with given fields:
func (_m *Index) GetFiles() []string {
ret := _m.Called()
var r0 []string
if rf, ok := ret.Get(0).(func() []string); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
return r0
}
// Index_GetFiles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFiles'
type Index_GetFiles_Call struct {
*mock.Call
}
// GetFiles is a helper method to define mock.On call
func (_e *Index_Expecter) GetFiles() *Index_GetFiles_Call {
return &Index_GetFiles_Call{Call: _e.mock.On("GetFiles")}
}
func (_c *Index_GetFiles_Call) Run(run func()) *Index_GetFiles_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Index_GetFiles_Call) Return(_a0 []string) *Index_GetFiles_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Index_GetFiles_Call) RunAndReturn(run func() []string) *Index_GetFiles_Call {
_c.Call.Return(run)
return _c
}
// GetFirstMatch provides a mock function with given fields: _a0
func (_m *Index) GetFirstMatch(_a0 []namer.ModuleID) (*policy.CompilationUnit, error) {
ret := _m.Called(_a0)
var r0 *policy.CompilationUnit
var r1 error
if rf, ok := ret.Get(0).(func([]namer.ModuleID) (*policy.CompilationUnit, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func([]namer.ModuleID) *policy.CompilationUnit); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*policy.CompilationUnit)
}
}
if rf, ok := ret.Get(1).(func([]namer.ModuleID) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_GetFirstMatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFirstMatch'
type Index_GetFirstMatch_Call struct {
*mock.Call
}
// GetFirstMatch is a helper method to define mock.On call
// - _a0 []namer.ModuleID
func (_e *Index_Expecter) GetFirstMatch(_a0 interface{}) *Index_GetFirstMatch_Call {
return &Index_GetFirstMatch_Call{Call: _e.mock.On("GetFirstMatch", _a0)}
}
func (_c *Index_GetFirstMatch_Call) Run(run func(_a0 []namer.ModuleID)) *Index_GetFirstMatch_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]namer.ModuleID))
})
return _c
}
func (_c *Index_GetFirstMatch_Call) Return(_a0 *policy.CompilationUnit, _a1 error) *Index_GetFirstMatch_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_GetFirstMatch_Call) RunAndReturn(run func([]namer.ModuleID) (*policy.CompilationUnit, error)) *Index_GetFirstMatch_Call {
_c.Call.Return(run)
return _c
}
// ListPolicyIDs provides a mock function with given fields: _a0
func (_m *Index) ListPolicyIDs(_a0 context.Context) ([]string, error) {
ret := _m.Called(_a0)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(context.Context) []string); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_ListPolicyIDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPolicyIDs'
type Index_ListPolicyIDs_Call struct {
*mock.Call
}
// ListPolicyIDs is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Index_Expecter) ListPolicyIDs(_a0 interface{}) *Index_ListPolicyIDs_Call {
return &Index_ListPolicyIDs_Call{Call: _e.mock.On("ListPolicyIDs", _a0)}
}
func (_c *Index_ListPolicyIDs_Call) Run(run func(_a0 context.Context)) *Index_ListPolicyIDs_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Index_ListPolicyIDs_Call) Return(_a0 []string, _a1 error) *Index_ListPolicyIDs_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_ListPolicyIDs_Call) RunAndReturn(run func(context.Context) ([]string, error)) *Index_ListPolicyIDs_Call {
_c.Call.Return(run)
return _c
}
// ListSchemaIDs provides a mock function with given fields: _a0
func (_m *Index) ListSchemaIDs(_a0 context.Context) ([]string, error) {
ret := _m.Called(_a0)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(context.Context) []string); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_ListSchemaIDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSchemaIDs'
type Index_ListSchemaIDs_Call struct {
*mock.Call
}
// ListSchemaIDs is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Index_Expecter) ListSchemaIDs(_a0 interface{}) *Index_ListSchemaIDs_Call {
return &Index_ListSchemaIDs_Call{Call: _e.mock.On("ListSchemaIDs", _a0)}
}
func (_c *Index_ListSchemaIDs_Call) Run(run func(_a0 context.Context)) *Index_ListSchemaIDs_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Index_ListSchemaIDs_Call) Return(_a0 []string, _a1 error) *Index_ListSchemaIDs_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_ListSchemaIDs_Call) RunAndReturn(run func(context.Context) ([]string, error)) *Index_ListSchemaIDs_Call {
_c.Call.Return(run)
return _c
}
// LoadPolicy provides a mock function with given fields: _a0, _a1
func (_m *Index) LoadPolicy(_a0 context.Context, _a1 ...string) ([]*policy.Wrapper, error) {
_va := make([]interface{}, len(_a1))
for _i := range _a1 {
_va[_i] = _a1[_i]
}
var _ca []interface{}
_ca = append(_ca, _a0)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 []*policy.Wrapper
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...string) ([]*policy.Wrapper, error)); ok {
return rf(_a0, _a1...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...string) []*policy.Wrapper); ok {
r0 = rf(_a0, _a1...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*policy.Wrapper)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...string) error); ok {
r1 = rf(_a0, _a1...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_LoadPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadPolicy'
type Index_LoadPolicy_Call struct {
*mock.Call
}
// LoadPolicy is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 ...string
func (_e *Index_Expecter) LoadPolicy(_a0 interface{}, _a1 ...interface{}) *Index_LoadPolicy_Call {
return &Index_LoadPolicy_Call{Call: _e.mock.On("LoadPolicy",
append([]interface{}{_a0}, _a1...)...)}
}
func (_c *Index_LoadPolicy_Call) Run(run func(_a0 context.Context, _a1 ...string)) *Index_LoadPolicy_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]string, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(string)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *Index_LoadPolicy_Call) Return(_a0 []*policy.Wrapper, _a1 error) *Index_LoadPolicy_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_LoadPolicy_Call) RunAndReturn(run func(context.Context, ...string) ([]*policy.Wrapper, error)) *Index_LoadPolicy_Call {
_c.Call.Return(run)
return _c
}
// LoadSchema provides a mock function with given fields: _a0, _a1
func (_m *Index) LoadSchema(_a0 context.Context, _a1 string) (io.ReadCloser, error) {
ret := _m.Called(_a0, _a1)
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (io.ReadCloser, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, string) io.ReadCloser); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_LoadSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadSchema'
type Index_LoadSchema_Call struct {
*mock.Call
}
// LoadSchema is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 string
func (_e *Index_Expecter) LoadSchema(_a0 interface{}, _a1 interface{}) *Index_LoadSchema_Call {
return &Index_LoadSchema_Call{Call: _e.mock.On("LoadSchema", _a0, _a1)}
}
func (_c *Index_LoadSchema_Call) Run(run func(_a0 context.Context, _a1 string)) *Index_LoadSchema_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *Index_LoadSchema_Call) Return(_a0 io.ReadCloser, _a1 error) *Index_LoadSchema_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_LoadSchema_Call) RunAndReturn(run func(context.Context, string) (io.ReadCloser, error)) *Index_LoadSchema_Call {
_c.Call.Return(run)
return _c
}
// Reload provides a mock function with given fields: ctx
func (_m *Index) Reload(ctx context.Context) ([]storage.Event, error) {
ret := _m.Called(ctx)
var r0 []storage.Event
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) ([]storage.Event, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) []storage.Event); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]storage.Event)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Index_Reload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Reload'
type Index_Reload_Call struct {
*mock.Call
}
// Reload is a helper method to define mock.On call
// - ctx context.Context
func (_e *Index_Expecter) Reload(ctx interface{}) *Index_Reload_Call {
return &Index_Reload_Call{Call: _e.mock.On("Reload", ctx)}
}
func (_c *Index_Reload_Call) Run(run func(ctx context.Context)) *Index_Reload_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Index_Reload_Call) Return(_a0 []storage.Event, _a1 error) *Index_Reload_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Index_Reload_Call) RunAndReturn(run func(context.Context) ([]storage.Event, error)) *Index_Reload_Call {
_c.Call.Return(run)
return _c
}
// RepoStats provides a mock function with given fields: _a0
func (_m *Index) RepoStats(_a0 context.Context) storage.RepoStats {
ret := _m.Called(_a0)
var r0 storage.RepoStats
if rf, ok := ret.Get(0).(func(context.Context) storage.RepoStats); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(storage.RepoStats)
}
return r0
}
// Index_RepoStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RepoStats'
type Index_RepoStats_Call struct {
*mock.Call
}
// RepoStats is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Index_Expecter) RepoStats(_a0 interface{}) *Index_RepoStats_Call {
return &Index_RepoStats_Call{Call: _e.mock.On("RepoStats", _a0)}
}
func (_c *Index_RepoStats_Call) Run(run func(_a0 context.Context)) *Index_RepoStats_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Index_RepoStats_Call) Return(_a0 storage.RepoStats) *Index_RepoStats_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Index_RepoStats_Call) RunAndReturn(run func(context.Context) storage.RepoStats) *Index_RepoStats_Call {
_c.Call.Return(run)
return _c
}
// NewIndex creates a new instance of Index. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewIndex(t interface {
mock.TestingT
Cleanup(func())
}) *Index {
mock := &Index{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}