forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_blob_manager_interface.go
424 lines (388 loc) · 11.2 KB
/
fake_blob_manager_interface.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
// Code generated by counterfeiter. DO NOT EDIT.
package blobstorefakes
import (
"io"
"sync"
"github.com/cloudfoundry/bosh-agent/agent/blobstore"
"github.com/cloudfoundry/bosh-utils/crypto"
"github.com/cloudfoundry/bosh-utils/system"
)
type FakeBlobManagerInterface struct {
BlobExistsStub func(string) bool
blobExistsMutex sync.RWMutex
blobExistsArgsForCall []struct {
arg1 string
}
blobExistsReturns struct {
result1 bool
}
blobExistsReturnsOnCall map[int]struct {
result1 bool
}
DeleteStub func(string) error
deleteMutex sync.RWMutex
deleteArgsForCall []struct {
arg1 string
}
deleteReturns struct {
result1 error
}
deleteReturnsOnCall map[int]struct {
result1 error
}
FetchStub func(string) (system.File, int, error)
fetchMutex sync.RWMutex
fetchArgsForCall []struct {
arg1 string
}
fetchReturns struct {
result1 system.File
result2 int
result3 error
}
fetchReturnsOnCall map[int]struct {
result1 system.File
result2 int
result3 error
}
GetPathStub func(string, crypto.Digest) (string, error)
getPathMutex sync.RWMutex
getPathArgsForCall []struct {
arg1 string
arg2 crypto.Digest
}
getPathReturns struct {
result1 string
result2 error
}
getPathReturnsOnCall map[int]struct {
result1 string
result2 error
}
WriteStub func(string, io.Reader) error
writeMutex sync.RWMutex
writeArgsForCall []struct {
arg1 string
arg2 io.Reader
}
writeReturns struct {
result1 error
}
writeReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeBlobManagerInterface) BlobExists(arg1 string) bool {
fake.blobExistsMutex.Lock()
ret, specificReturn := fake.blobExistsReturnsOnCall[len(fake.blobExistsArgsForCall)]
fake.blobExistsArgsForCall = append(fake.blobExistsArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("BlobExists", []interface{}{arg1})
fake.blobExistsMutex.Unlock()
if fake.BlobExistsStub != nil {
return fake.BlobExistsStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.blobExistsReturns
return fakeReturns.result1
}
func (fake *FakeBlobManagerInterface) BlobExistsCallCount() int {
fake.blobExistsMutex.RLock()
defer fake.blobExistsMutex.RUnlock()
return len(fake.blobExistsArgsForCall)
}
func (fake *FakeBlobManagerInterface) BlobExistsCalls(stub func(string) bool) {
fake.blobExistsMutex.Lock()
defer fake.blobExistsMutex.Unlock()
fake.BlobExistsStub = stub
}
func (fake *FakeBlobManagerInterface) BlobExistsArgsForCall(i int) string {
fake.blobExistsMutex.RLock()
defer fake.blobExistsMutex.RUnlock()
argsForCall := fake.blobExistsArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeBlobManagerInterface) BlobExistsReturns(result1 bool) {
fake.blobExistsMutex.Lock()
defer fake.blobExistsMutex.Unlock()
fake.BlobExistsStub = nil
fake.blobExistsReturns = struct {
result1 bool
}{result1}
}
func (fake *FakeBlobManagerInterface) BlobExistsReturnsOnCall(i int, result1 bool) {
fake.blobExistsMutex.Lock()
defer fake.blobExistsMutex.Unlock()
fake.BlobExistsStub = nil
if fake.blobExistsReturnsOnCall == nil {
fake.blobExistsReturnsOnCall = make(map[int]struct {
result1 bool
})
}
fake.blobExistsReturnsOnCall[i] = struct {
result1 bool
}{result1}
}
func (fake *FakeBlobManagerInterface) Delete(arg1 string) error {
fake.deleteMutex.Lock()
ret, specificReturn := fake.deleteReturnsOnCall[len(fake.deleteArgsForCall)]
fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("Delete", []interface{}{arg1})
fake.deleteMutex.Unlock()
if fake.DeleteStub != nil {
return fake.DeleteStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.deleteReturns
return fakeReturns.result1
}
func (fake *FakeBlobManagerInterface) DeleteCallCount() int {
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
return len(fake.deleteArgsForCall)
}
func (fake *FakeBlobManagerInterface) DeleteCalls(stub func(string) error) {
fake.deleteMutex.Lock()
defer fake.deleteMutex.Unlock()
fake.DeleteStub = stub
}
func (fake *FakeBlobManagerInterface) DeleteArgsForCall(i int) string {
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
argsForCall := fake.deleteArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeBlobManagerInterface) DeleteReturns(result1 error) {
fake.deleteMutex.Lock()
defer fake.deleteMutex.Unlock()
fake.DeleteStub = nil
fake.deleteReturns = struct {
result1 error
}{result1}
}
func (fake *FakeBlobManagerInterface) DeleteReturnsOnCall(i int, result1 error) {
fake.deleteMutex.Lock()
defer fake.deleteMutex.Unlock()
fake.DeleteStub = nil
if fake.deleteReturnsOnCall == nil {
fake.deleteReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.deleteReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeBlobManagerInterface) Fetch(arg1 string) (system.File, int, error) {
fake.fetchMutex.Lock()
ret, specificReturn := fake.fetchReturnsOnCall[len(fake.fetchArgsForCall)]
fake.fetchArgsForCall = append(fake.fetchArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("Fetch", []interface{}{arg1})
fake.fetchMutex.Unlock()
if fake.FetchStub != nil {
return fake.FetchStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
fakeReturns := fake.fetchReturns
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}
func (fake *FakeBlobManagerInterface) FetchCallCount() int {
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
return len(fake.fetchArgsForCall)
}
func (fake *FakeBlobManagerInterface) FetchCalls(stub func(string) (system.File, int, error)) {
fake.fetchMutex.Lock()
defer fake.fetchMutex.Unlock()
fake.FetchStub = stub
}
func (fake *FakeBlobManagerInterface) FetchArgsForCall(i int) string {
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
argsForCall := fake.fetchArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeBlobManagerInterface) FetchReturns(result1 system.File, result2 int, result3 error) {
fake.fetchMutex.Lock()
defer fake.fetchMutex.Unlock()
fake.FetchStub = nil
fake.fetchReturns = struct {
result1 system.File
result2 int
result3 error
}{result1, result2, result3}
}
func (fake *FakeBlobManagerInterface) FetchReturnsOnCall(i int, result1 system.File, result2 int, result3 error) {
fake.fetchMutex.Lock()
defer fake.fetchMutex.Unlock()
fake.FetchStub = nil
if fake.fetchReturnsOnCall == nil {
fake.fetchReturnsOnCall = make(map[int]struct {
result1 system.File
result2 int
result3 error
})
}
fake.fetchReturnsOnCall[i] = struct {
result1 system.File
result2 int
result3 error
}{result1, result2, result3}
}
func (fake *FakeBlobManagerInterface) GetPath(arg1 string, arg2 crypto.Digest) (string, error) {
fake.getPathMutex.Lock()
ret, specificReturn := fake.getPathReturnsOnCall[len(fake.getPathArgsForCall)]
fake.getPathArgsForCall = append(fake.getPathArgsForCall, struct {
arg1 string
arg2 crypto.Digest
}{arg1, arg2})
fake.recordInvocation("GetPath", []interface{}{arg1, arg2})
fake.getPathMutex.Unlock()
if fake.GetPathStub != nil {
return fake.GetPathStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getPathReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeBlobManagerInterface) GetPathCallCount() int {
fake.getPathMutex.RLock()
defer fake.getPathMutex.RUnlock()
return len(fake.getPathArgsForCall)
}
func (fake *FakeBlobManagerInterface) GetPathCalls(stub func(string, crypto.Digest) (string, error)) {
fake.getPathMutex.Lock()
defer fake.getPathMutex.Unlock()
fake.GetPathStub = stub
}
func (fake *FakeBlobManagerInterface) GetPathArgsForCall(i int) (string, crypto.Digest) {
fake.getPathMutex.RLock()
defer fake.getPathMutex.RUnlock()
argsForCall := fake.getPathArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeBlobManagerInterface) GetPathReturns(result1 string, result2 error) {
fake.getPathMutex.Lock()
defer fake.getPathMutex.Unlock()
fake.GetPathStub = nil
fake.getPathReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeBlobManagerInterface) GetPathReturnsOnCall(i int, result1 string, result2 error) {
fake.getPathMutex.Lock()
defer fake.getPathMutex.Unlock()
fake.GetPathStub = nil
if fake.getPathReturnsOnCall == nil {
fake.getPathReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.getPathReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeBlobManagerInterface) Write(arg1 string, arg2 io.Reader) error {
fake.writeMutex.Lock()
ret, specificReturn := fake.writeReturnsOnCall[len(fake.writeArgsForCall)]
fake.writeArgsForCall = append(fake.writeArgsForCall, struct {
arg1 string
arg2 io.Reader
}{arg1, arg2})
fake.recordInvocation("Write", []interface{}{arg1, arg2})
fake.writeMutex.Unlock()
if fake.WriteStub != nil {
return fake.WriteStub(arg1, arg2)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.writeReturns
return fakeReturns.result1
}
func (fake *FakeBlobManagerInterface) WriteCallCount() int {
fake.writeMutex.RLock()
defer fake.writeMutex.RUnlock()
return len(fake.writeArgsForCall)
}
func (fake *FakeBlobManagerInterface) WriteCalls(stub func(string, io.Reader) error) {
fake.writeMutex.Lock()
defer fake.writeMutex.Unlock()
fake.WriteStub = stub
}
func (fake *FakeBlobManagerInterface) WriteArgsForCall(i int) (string, io.Reader) {
fake.writeMutex.RLock()
defer fake.writeMutex.RUnlock()
argsForCall := fake.writeArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeBlobManagerInterface) WriteReturns(result1 error) {
fake.writeMutex.Lock()
defer fake.writeMutex.Unlock()
fake.WriteStub = nil
fake.writeReturns = struct {
result1 error
}{result1}
}
func (fake *FakeBlobManagerInterface) WriteReturnsOnCall(i int, result1 error) {
fake.writeMutex.Lock()
defer fake.writeMutex.Unlock()
fake.WriteStub = nil
if fake.writeReturnsOnCall == nil {
fake.writeReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.writeReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeBlobManagerInterface) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.blobExistsMutex.RLock()
defer fake.blobExistsMutex.RUnlock()
fake.deleteMutex.RLock()
defer fake.deleteMutex.RUnlock()
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
fake.getPathMutex.RLock()
defer fake.getPathMutex.RUnlock()
fake.writeMutex.RLock()
defer fake.writeMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeBlobManagerInterface) 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 _ blobstore.BlobManagerInterface = new(FakeBlobManagerInterface)