forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_ociruntime.go
585 lines (539 loc) · 16.8 KB
/
fake_ociruntime.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
// Code generated by counterfeiter. DO NOT EDIT.
package rundmcfakes
import (
"sync"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/guardian/gardener"
"code.cloudfoundry.org/guardian/rundmc"
"code.cloudfoundry.org/guardian/rundmc/runrunc"
"code.cloudfoundry.org/lager"
)
type FakeOCIRuntime struct {
CreateStub func(log lager.Logger, bundlePath, id string, io garden.ProcessIO) error
createMutex sync.RWMutex
createArgsForCall []struct {
log lager.Logger
bundlePath string
id string
io garden.ProcessIO
}
createReturns struct {
result1 error
}
createReturnsOnCall map[int]struct {
result1 error
}
ExecStub func(log lager.Logger, bundlePath, id string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error)
execMutex sync.RWMutex
execArgsForCall []struct {
log lager.Logger
bundlePath string
id string
spec garden.ProcessSpec
io garden.ProcessIO
}
execReturns struct {
result1 garden.Process
result2 error
}
execReturnsOnCall map[int]struct {
result1 garden.Process
result2 error
}
AttachStub func(log lager.Logger, bundlePath, id, processId string, io garden.ProcessIO) (garden.Process, error)
attachMutex sync.RWMutex
attachArgsForCall []struct {
log lager.Logger
bundlePath string
id string
processId string
io garden.ProcessIO
}
attachReturns struct {
result1 garden.Process
result2 error
}
attachReturnsOnCall map[int]struct {
result1 garden.Process
result2 error
}
KillStub func(log lager.Logger, bundlePath string) error
killMutex sync.RWMutex
killArgsForCall []struct {
log lager.Logger
bundlePath string
}
killReturns struct {
result1 error
}
killReturnsOnCall map[int]struct {
result1 error
}
DeleteStub func(log lager.Logger, force bool, bundlePath string) error
deleteMutex sync.RWMutex
deleteArgsForCall []struct {
log lager.Logger
force bool
bundlePath string
}
deleteReturns struct {
result1 error
}
deleteReturnsOnCall map[int]struct {
result1 error
}
StateStub func(log lager.Logger, id string) (runrunc.State, error)
stateMutex sync.RWMutex
stateArgsForCall []struct {
log lager.Logger
id string
}
stateReturns struct {
result1 runrunc.State
result2 error
}
stateReturnsOnCall map[int]struct {
result1 runrunc.State
result2 error
}
StatsStub func(log lager.Logger, id string) (gardener.ActualContainerMetrics, error)
statsMutex sync.RWMutex
statsArgsForCall []struct {
log lager.Logger
id string
}
statsReturns struct {
result1 gardener.ActualContainerMetrics
result2 error
}
statsReturnsOnCall map[int]struct {
result1 gardener.ActualContainerMetrics
result2 error
}
WatchEventsStub func(log lager.Logger, id string, eventsNotifier runrunc.EventsNotifier) error
watchEventsMutex sync.RWMutex
watchEventsArgsForCall []struct {
log lager.Logger
id string
eventsNotifier runrunc.EventsNotifier
}
watchEventsReturns struct {
result1 error
}
watchEventsReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeOCIRuntime) Create(log lager.Logger, bundlePath string, id string, io garden.ProcessIO) error {
fake.createMutex.Lock()
ret, specificReturn := fake.createReturnsOnCall[len(fake.createArgsForCall)]
fake.createArgsForCall = append(fake.createArgsForCall, struct {
log lager.Logger
bundlePath string
id string
io garden.ProcessIO
}{log, bundlePath, id, io})
fake.recordInvocation("Create", []interface{}{log, bundlePath, id, io})
fake.createMutex.Unlock()
if fake.CreateStub != nil {
return fake.CreateStub(log, bundlePath, id, io)
}
if specificReturn {
return ret.result1
}
return fake.createReturns.result1
}
func (fake *FakeOCIRuntime) CreateCallCount() int {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return len(fake.createArgsForCall)
}
func (fake *FakeOCIRuntime) CreateArgsForCall(i int) (lager.Logger, string, string, garden.ProcessIO) {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return fake.createArgsForCall[i].log, fake.createArgsForCall[i].bundlePath, fake.createArgsForCall[i].id, fake.createArgsForCall[i].io
}
func (fake *FakeOCIRuntime) CreateReturns(result1 error) {
fake.CreateStub = nil
fake.createReturns = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) CreateReturnsOnCall(i int, result1 error) {
fake.CreateStub = nil
if fake.createReturnsOnCall == nil {
fake.createReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.createReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) Exec(log lager.Logger, bundlePath string, id string, spec garden.ProcessSpec, io garden.ProcessIO) (garden.Process, error) {
fake.execMutex.Lock()
ret, specificReturn := fake.execReturnsOnCall[len(fake.execArgsForCall)]
fake.execArgsForCall = append(fake.execArgsForCall, struct {
log lager.Logger
bundlePath string
id string
spec garden.ProcessSpec
io garden.ProcessIO
}{log, bundlePath, id, spec, io})
fake.recordInvocation("Exec", []interface{}{log, bundlePath, id, spec, io})
fake.execMutex.Unlock()
if fake.ExecStub != nil {
return fake.ExecStub(log, bundlePath, id, spec, io)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.execReturns.result1, fake.execReturns.result2
}
func (fake *FakeOCIRuntime) ExecCallCount() int {
fake.execMutex.RLock()
defer fake.execMutex.RUnlock()
return len(fake.execArgsForCall)
}
func (fake *FakeOCIRuntime) ExecArgsForCall(i int) (lager.Logger, string, string, garden.ProcessSpec, garden.ProcessIO) {
fake.execMutex.RLock()
defer fake.execMutex.RUnlock()
return fake.execArgsForCall[i].log, fake.execArgsForCall[i].bundlePath, fake.execArgsForCall[i].id, fake.execArgsForCall[i].spec, fake.execArgsForCall[i].io
}
func (fake *FakeOCIRuntime) ExecReturns(result1 garden.Process, result2 error) {
fake.ExecStub = nil
fake.execReturns = struct {
result1 garden.Process
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) ExecReturnsOnCall(i int, result1 garden.Process, result2 error) {
fake.ExecStub = nil
if fake.execReturnsOnCall == nil {
fake.execReturnsOnCall = make(map[int]struct {
result1 garden.Process
result2 error
})
}
fake.execReturnsOnCall[i] = struct {
result1 garden.Process
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) Attach(log lager.Logger, bundlePath string, id string, processId string, io garden.ProcessIO) (garden.Process, error) {
fake.attachMutex.Lock()
ret, specificReturn := fake.attachReturnsOnCall[len(fake.attachArgsForCall)]
fake.attachArgsForCall = append(fake.attachArgsForCall, struct {
log lager.Logger
bundlePath string
id string
processId string
io garden.ProcessIO
}{log, bundlePath, id, processId, io})
fake.recordInvocation("Attach", []interface{}{log, bundlePath, id, processId, io})
fake.attachMutex.Unlock()
if fake.AttachStub != nil {
return fake.AttachStub(log, bundlePath, id, processId, io)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.attachReturns.result1, fake.attachReturns.result2
}
func (fake *FakeOCIRuntime) AttachCallCount() int {
fake.attachMutex.RLock()
defer fake.attachMutex.RUnlock()
return len(fake.attachArgsForCall)
}
func (fake *FakeOCIRuntime) AttachArgsForCall(i int) (lager.Logger, string, string, string, garden.ProcessIO) {
fake.attachMutex.RLock()
defer fake.attachMutex.RUnlock()
return fake.attachArgsForCall[i].log, fake.attachArgsForCall[i].bundlePath, fake.attachArgsForCall[i].id, fake.attachArgsForCall[i].processId, fake.attachArgsForCall[i].io
}
func (fake *FakeOCIRuntime) AttachReturns(result1 garden.Process, result2 error) {
fake.AttachStub = nil
fake.attachReturns = struct {
result1 garden.Process
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) AttachReturnsOnCall(i int, result1 garden.Process, result2 error) {
fake.AttachStub = nil
if fake.attachReturnsOnCall == nil {
fake.attachReturnsOnCall = make(map[int]struct {
result1 garden.Process
result2 error
})
}
fake.attachReturnsOnCall[i] = struct {
result1 garden.Process
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) Kill(log lager.Logger, bundlePath string) error {
fake.killMutex.Lock()
ret, specificReturn := fake.killReturnsOnCall[len(fake.killArgsForCall)]
fake.killArgsForCall = append(fake.killArgsForCall, struct {
log lager.Logger
bundlePath string
}{log, bundlePath})
fake.recordInvocation("Kill", []interface{}{log, bundlePath})
fake.killMutex.Unlock()
if fake.KillStub != nil {
return fake.KillStub(log, bundlePath)
}
if specificReturn {
return ret.result1
}
return fake.killReturns.result1
}
func (fake *FakeOCIRuntime) KillCallCount() int {
fake.killMutex.RLock()
defer fake.killMutex.RUnlock()
return len(fake.killArgsForCall)
}
func (fake *FakeOCIRuntime) KillArgsForCall(i int) (lager.Logger, string) {
fake.killMutex.RLock()
defer fake.killMutex.RUnlock()
return fake.killArgsForCall[i].log, fake.killArgsForCall[i].bundlePath
}
func (fake *FakeOCIRuntime) KillReturns(result1 error) {
fake.KillStub = nil
fake.killReturns = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) KillReturnsOnCall(i int, result1 error) {
fake.KillStub = nil
if fake.killReturnsOnCall == nil {
fake.killReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.killReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) Delete(log lager.Logger, force bool, bundlePath string) error {
fake.deleteMutex.Lock()
ret, specificReturn := fake.deleteReturnsOnCall[len(fake.deleteArgsForCall)]
fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct {
log lager.Logger
force bool
bundlePath string
}{log, force, bundlePath})
fake.recordInvocation("Delete", []interface{}{log, force, bundlePath})
fake.deleteMutex.Unlock()
if fake.DeleteStub != nil {
return fake.DeleteStub(log, force, bundlePath)
}
if specificReturn {
return ret.result1
}
return fake.deleteReturns.result1
}
func (fake *FakeOCIRuntime) DeleteCallCount() int {
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
return len(fake.deleteArgsForCall)
}
func (fake *FakeOCIRuntime) DeleteArgsForCall(i int) (lager.Logger, bool, string) {
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
return fake.deleteArgsForCall[i].log, fake.deleteArgsForCall[i].force, fake.deleteArgsForCall[i].bundlePath
}
func (fake *FakeOCIRuntime) DeleteReturns(result1 error) {
fake.DeleteStub = nil
fake.deleteReturns = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) DeleteReturnsOnCall(i int, result1 error) {
fake.DeleteStub = nil
if fake.deleteReturnsOnCall == nil {
fake.deleteReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.deleteReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) State(log lager.Logger, id string) (runrunc.State, error) {
fake.stateMutex.Lock()
ret, specificReturn := fake.stateReturnsOnCall[len(fake.stateArgsForCall)]
fake.stateArgsForCall = append(fake.stateArgsForCall, struct {
log lager.Logger
id string
}{log, id})
fake.recordInvocation("State", []interface{}{log, id})
fake.stateMutex.Unlock()
if fake.StateStub != nil {
return fake.StateStub(log, id)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.stateReturns.result1, fake.stateReturns.result2
}
func (fake *FakeOCIRuntime) StateCallCount() int {
fake.stateMutex.RLock()
defer fake.stateMutex.RUnlock()
return len(fake.stateArgsForCall)
}
func (fake *FakeOCIRuntime) StateArgsForCall(i int) (lager.Logger, string) {
fake.stateMutex.RLock()
defer fake.stateMutex.RUnlock()
return fake.stateArgsForCall[i].log, fake.stateArgsForCall[i].id
}
func (fake *FakeOCIRuntime) StateReturns(result1 runrunc.State, result2 error) {
fake.StateStub = nil
fake.stateReturns = struct {
result1 runrunc.State
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) StateReturnsOnCall(i int, result1 runrunc.State, result2 error) {
fake.StateStub = nil
if fake.stateReturnsOnCall == nil {
fake.stateReturnsOnCall = make(map[int]struct {
result1 runrunc.State
result2 error
})
}
fake.stateReturnsOnCall[i] = struct {
result1 runrunc.State
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) Stats(log lager.Logger, id string) (gardener.ActualContainerMetrics, error) {
fake.statsMutex.Lock()
ret, specificReturn := fake.statsReturnsOnCall[len(fake.statsArgsForCall)]
fake.statsArgsForCall = append(fake.statsArgsForCall, struct {
log lager.Logger
id string
}{log, id})
fake.recordInvocation("Stats", []interface{}{log, id})
fake.statsMutex.Unlock()
if fake.StatsStub != nil {
return fake.StatsStub(log, id)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.statsReturns.result1, fake.statsReturns.result2
}
func (fake *FakeOCIRuntime) StatsCallCount() int {
fake.statsMutex.RLock()
defer fake.statsMutex.RUnlock()
return len(fake.statsArgsForCall)
}
func (fake *FakeOCIRuntime) StatsArgsForCall(i int) (lager.Logger, string) {
fake.statsMutex.RLock()
defer fake.statsMutex.RUnlock()
return fake.statsArgsForCall[i].log, fake.statsArgsForCall[i].id
}
func (fake *FakeOCIRuntime) StatsReturns(result1 gardener.ActualContainerMetrics, result2 error) {
fake.StatsStub = nil
fake.statsReturns = struct {
result1 gardener.ActualContainerMetrics
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) StatsReturnsOnCall(i int, result1 gardener.ActualContainerMetrics, result2 error) {
fake.StatsStub = nil
if fake.statsReturnsOnCall == nil {
fake.statsReturnsOnCall = make(map[int]struct {
result1 gardener.ActualContainerMetrics
result2 error
})
}
fake.statsReturnsOnCall[i] = struct {
result1 gardener.ActualContainerMetrics
result2 error
}{result1, result2}
}
func (fake *FakeOCIRuntime) WatchEvents(log lager.Logger, id string, eventsNotifier runrunc.EventsNotifier) error {
fake.watchEventsMutex.Lock()
ret, specificReturn := fake.watchEventsReturnsOnCall[len(fake.watchEventsArgsForCall)]
fake.watchEventsArgsForCall = append(fake.watchEventsArgsForCall, struct {
log lager.Logger
id string
eventsNotifier runrunc.EventsNotifier
}{log, id, eventsNotifier})
fake.recordInvocation("WatchEvents", []interface{}{log, id, eventsNotifier})
fake.watchEventsMutex.Unlock()
if fake.WatchEventsStub != nil {
return fake.WatchEventsStub(log, id, eventsNotifier)
}
if specificReturn {
return ret.result1
}
return fake.watchEventsReturns.result1
}
func (fake *FakeOCIRuntime) WatchEventsCallCount() int {
fake.watchEventsMutex.RLock()
defer fake.watchEventsMutex.RUnlock()
return len(fake.watchEventsArgsForCall)
}
func (fake *FakeOCIRuntime) WatchEventsArgsForCall(i int) (lager.Logger, string, runrunc.EventsNotifier) {
fake.watchEventsMutex.RLock()
defer fake.watchEventsMutex.RUnlock()
return fake.watchEventsArgsForCall[i].log, fake.watchEventsArgsForCall[i].id, fake.watchEventsArgsForCall[i].eventsNotifier
}
func (fake *FakeOCIRuntime) WatchEventsReturns(result1 error) {
fake.WatchEventsStub = nil
fake.watchEventsReturns = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) WatchEventsReturnsOnCall(i int, result1 error) {
fake.WatchEventsStub = nil
if fake.watchEventsReturnsOnCall == nil {
fake.watchEventsReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.watchEventsReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeOCIRuntime) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
fake.execMutex.RLock()
defer fake.execMutex.RUnlock()
fake.attachMutex.RLock()
defer fake.attachMutex.RUnlock()
fake.killMutex.RLock()
defer fake.killMutex.RUnlock()
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
fake.stateMutex.RLock()
defer fake.stateMutex.RUnlock()
fake.statsMutex.RLock()
defer fake.statsMutex.RUnlock()
fake.watchEventsMutex.RLock()
defer fake.watchEventsMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeOCIRuntime) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ rundmc.OCIRuntime = new(FakeOCIRuntime)