-
Notifications
You must be signed in to change notification settings - Fork 24
/
container_tasks.go
531 lines (434 loc) · 13.8 KB
/
container_tasks.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
// Code generated by mockery v2.20.0. DO NOT EDIT.
package mocks
import (
io "io"
types "github.com/jumppad-labs/jumppad/pkg/clients/container/types"
mock "github.com/stretchr/testify/mock"
)
// ContainerTasks is an autogenerated mock type for the ContainerTasks type
type ContainerTasks struct {
mock.Mock
}
// AttachNetwork provides a mock function with given fields: network, containerid, aliases, ipaddress
func (_m *ContainerTasks) AttachNetwork(network string, containerid string, aliases []string, ipaddress string) error {
ret := _m.Called(network, containerid, aliases, ipaddress)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, []string, string) error); ok {
r0 = rf(network, containerid, aliases, ipaddress)
} else {
r0 = ret.Error(0)
}
return r0
}
// BuildContainer provides a mock function with given fields: config, force
func (_m *ContainerTasks) BuildContainer(config *types.Build, force bool) (string, error) {
ret := _m.Called(config, force)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(*types.Build, bool) (string, error)); ok {
return rf(config, force)
}
if rf, ok := ret.Get(0).(func(*types.Build, bool) string); ok {
r0 = rf(config, force)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(*types.Build, bool) error); ok {
r1 = rf(config, force)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ContainerInfo provides a mock function with given fields: id
func (_m *ContainerTasks) ContainerInfo(id string) (interface{}, error) {
ret := _m.Called(id)
var r0 interface{}
var r1 error
if rf, ok := ret.Get(0).(func(string) (interface{}, error)); ok {
return rf(id)
}
if rf, ok := ret.Get(0).(func(string) interface{}); ok {
r0 = rf(id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(interface{})
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ContainerLogs provides a mock function with given fields: id, stdOut, stdErr
func (_m *ContainerTasks) ContainerLogs(id string, stdOut bool, stdErr bool) (io.ReadCloser, error) {
ret := _m.Called(id, stdOut, stdErr)
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(string, bool, bool) (io.ReadCloser, error)); ok {
return rf(id, stdOut, stdErr)
}
if rf, ok := ret.Get(0).(func(string, bool, bool) io.ReadCloser); ok {
r0 = rf(id, stdOut, stdErr)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
}
}
if rf, ok := ret.Get(1).(func(string, bool, bool) error); ok {
r1 = rf(id, stdOut, stdErr)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CopyFileToContainer provides a mock function with given fields: id, src, dst
func (_m *ContainerTasks) CopyFileToContainer(id string, src string, dst string) error {
ret := _m.Called(id, src, dst)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(id, src, dst)
} else {
r0 = ret.Error(0)
}
return r0
}
// CopyFilesToVolume provides a mock function with given fields: volume, files, path, force
func (_m *ContainerTasks) CopyFilesToVolume(volume string, files []string, path string, force bool) ([]string, error) {
ret := _m.Called(volume, files, path, force)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(string, []string, string, bool) ([]string, error)); ok {
return rf(volume, files, path, force)
}
if rf, ok := ret.Get(0).(func(string, []string, string, bool) []string); ok {
r0 = rf(volume, files, path, force)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(string, []string, string, bool) error); ok {
r1 = rf(volume, files, path, force)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CopyFromContainer provides a mock function with given fields: id, src, dst
func (_m *ContainerTasks) CopyFromContainer(id string, src string, dst string) error {
ret := _m.Called(id, src, dst)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(id, src, dst)
} else {
r0 = ret.Error(0)
}
return r0
}
// CopyLocalDockerImagesToVolume provides a mock function with given fields: images, volume, force
func (_m *ContainerTasks) CopyLocalDockerImagesToVolume(images []string, volume string, force bool) ([]string, error) {
ret := _m.Called(images, volume, force)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func([]string, string, bool) ([]string, error)); ok {
return rf(images, volume, force)
}
if rf, ok := ret.Get(0).(func([]string, string, bool) []string); ok {
r0 = rf(images, volume, force)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func([]string, string, bool) error); ok {
r1 = rf(images, volume, force)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateContainer provides a mock function with given fields: _a0
func (_m *ContainerTasks) CreateContainer(_a0 *types.Container) (string, error) {
ret := _m.Called(_a0)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(*types.Container) (string, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*types.Container) string); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(*types.Container) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateFileInContainer provides a mock function with given fields: containerID, contents, filename, path
func (_m *ContainerTasks) CreateFileInContainer(containerID string, contents string, filename string, path string) error {
ret := _m.Called(containerID, contents, filename, path)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string, string) error); ok {
r0 = rf(containerID, contents, filename, path)
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateShell provides a mock function with given fields: id, command, stdin, stdout, stderr
func (_m *ContainerTasks) CreateShell(id string, command []string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error {
ret := _m.Called(id, command, stdin, stdout, stderr)
var r0 error
if rf, ok := ret.Get(0).(func(string, []string, io.ReadCloser, io.Writer, io.Writer) error); ok {
r0 = rf(id, command, stdin, stdout, stderr)
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateVolume provides a mock function with given fields: name
func (_m *ContainerTasks) CreateVolume(name string) (string, error) {
ret := _m.Called(name)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string) (string, error)); ok {
return rf(name)
}
if rf, ok := ret.Get(0).(func(string) string); ok {
r0 = rf(name)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DetachNetwork provides a mock function with given fields: network, containerid
func (_m *ContainerTasks) DetachNetwork(network string, containerid string) error {
ret := _m.Called(network, containerid)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(network, containerid)
} else {
r0 = ret.Error(0)
}
return r0
}
// EngineInfo provides a mock function with given fields:
func (_m *ContainerTasks) EngineInfo() *types.EngineInfo {
ret := _m.Called()
var r0 *types.EngineInfo
if rf, ok := ret.Get(0).(func() *types.EngineInfo); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.EngineInfo)
}
}
return r0
}
// ExecuteCommand provides a mock function with given fields: id, command, env, workingDirectory, user, group, timeout, writer
func (_m *ContainerTasks) ExecuteCommand(id string, command []string, env []string, workingDirectory string, user string, group string, timeout int, writer io.Writer) (int, error) {
ret := _m.Called(id, command, env, workingDirectory, user, group, timeout, writer)
var r0 int
var r1 error
if rf, ok := ret.Get(0).(func(string, []string, []string, string, string, string, int, io.Writer) (int, error)); ok {
return rf(id, command, env, workingDirectory, user, group, timeout, writer)
}
if rf, ok := ret.Get(0).(func(string, []string, []string, string, string, string, int, io.Writer) int); ok {
r0 = rf(id, command, env, workingDirectory, user, group, timeout, writer)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func(string, []string, []string, string, string, string, int, io.Writer) error); ok {
r1 = rf(id, command, env, workingDirectory, user, group, timeout, writer)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ExecuteScript provides a mock function with given fields: id, contents, env, workingDirectory, user, group, timeout, writer
func (_m *ContainerTasks) ExecuteScript(id string, contents string, env []string, workingDirectory string, user string, group string, timeout int, writer io.Writer) (int, error) {
ret := _m.Called(id, contents, env, workingDirectory, user, group, timeout, writer)
var r0 int
var r1 error
if rf, ok := ret.Get(0).(func(string, string, []string, string, string, string, int, io.Writer) (int, error)); ok {
return rf(id, contents, env, workingDirectory, user, group, timeout, writer)
}
if rf, ok := ret.Get(0).(func(string, string, []string, string, string, string, int, io.Writer) int); ok {
r0 = rf(id, contents, env, workingDirectory, user, group, timeout, writer)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func(string, string, []string, string, string, string, int, io.Writer) error); ok {
r1 = rf(id, contents, env, workingDirectory, user, group, timeout, writer)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FindContainerIDs provides a mock function with given fields: fqdn
func (_m *ContainerTasks) FindContainerIDs(fqdn string) ([]string, error) {
ret := _m.Called(fqdn)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok {
return rf(fqdn)
}
if rf, ok := ret.Get(0).(func(string) []string); ok {
r0 = rf(fqdn)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(fqdn)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FindImageInLocalRegistry provides a mock function with given fields: image
func (_m *ContainerTasks) FindImageInLocalRegistry(image types.Image) (string, error) {
ret := _m.Called(image)
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(types.Image) (string, error)); ok {
return rf(image)
}
if rf, ok := ret.Get(0).(func(types.Image) string); ok {
r0 = rf(image)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(types.Image) error); ok {
r1 = rf(image)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FindImagesInLocalRegistry provides a mock function with given fields: filter
func (_m *ContainerTasks) FindImagesInLocalRegistry(filter string) ([]string, error) {
ret := _m.Called(filter)
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok {
return rf(filter)
}
if rf, ok := ret.Get(0).(func(string) []string); ok {
r0 = rf(filter)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(filter)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// FindNetwork provides a mock function with given fields: id
func (_m *ContainerTasks) FindNetwork(id string) (types.NetworkAttachment, error) {
ret := _m.Called(id)
var r0 types.NetworkAttachment
var r1 error
if rf, ok := ret.Get(0).(func(string) (types.NetworkAttachment, error)); ok {
return rf(id)
}
if rf, ok := ret.Get(0).(func(string) types.NetworkAttachment); ok {
r0 = rf(id)
} else {
r0 = ret.Get(0).(types.NetworkAttachment)
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListNetworks provides a mock function with given fields: id
func (_m *ContainerTasks) ListNetworks(id string) []types.NetworkAttachment {
ret := _m.Called(id)
var r0 []types.NetworkAttachment
if rf, ok := ret.Get(0).(func(string) []types.NetworkAttachment); ok {
r0 = rf(id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]types.NetworkAttachment)
}
}
return r0
}
// PullImage provides a mock function with given fields: image, force
func (_m *ContainerTasks) PullImage(image types.Image, force bool) error {
ret := _m.Called(image, force)
var r0 error
if rf, ok := ret.Get(0).(func(types.Image, bool) error); ok {
r0 = rf(image, force)
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveContainer provides a mock function with given fields: id, force
func (_m *ContainerTasks) RemoveContainer(id string, force bool) error {
ret := _m.Called(id, force)
var r0 error
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
r0 = rf(id, force)
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveImage provides a mock function with given fields: id
func (_m *ContainerTasks) RemoveImage(id string) error {
ret := _m.Called(id)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(id)
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveVolume provides a mock function with given fields: name
func (_m *ContainerTasks) RemoveVolume(name string) error {
ret := _m.Called(name)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(name)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetForcePull provides a mock function with given fields: _a0
func (_m *ContainerTasks) SetForcePull(_a0 bool) {
_m.Called(_a0)
}
type mockConstructorTestingTNewContainerTasks interface {
mock.TestingT
Cleanup(func())
}
// NewContainerTasks creates a new instance of ContainerTasks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewContainerTasks(t mockConstructorTestingTNewContainerTasks) *ContainerTasks {
mock := &ContainerTasks{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}