@@ -12,25 +12,26 @@ import (
12
12
"github.com/docker/docker/api/types/image"
13
13
networktypes "github.com/docker/docker/api/types/network"
14
14
"github.com/docker/docker/api/types/registry"
15
+ "github.com/docker/docker/api/types/system"
15
16
specs "github.com/opencontainers/image-spec/specs-go/v1"
16
17
17
18
"github.com/coder/envbox/dockerutil"
18
19
)
19
20
20
- var _ dockerutil.DockerClient = MockClient {}
21
+ var _ dockerutil.Client = MockClient {}
21
22
22
23
// MockClient provides overrides for functions that are called in envbox.
23
24
type MockClient struct {
24
- ImagePullFn func (_ context.Context , ref string , options dockertypes. ImagePullOptions ) (io.ReadCloser , error )
25
+ ImagePullFn func (_ context.Context , ref string , options image. PullOptions ) (io.ReadCloser , error )
25
26
ContainerCreateFn func (_ context.Context , config * containertypes.Config , hostConfig * containertypes.HostConfig , networkingConfig * networktypes.NetworkingConfig , _ * specs.Platform , containerName string ) (containertypes.CreateResponse , error )
26
27
ImagePruneFn func (_ context.Context , pruneFilter filters.Args ) (dockertypes.ImagesPruneReport , error )
27
- ContainerStartFn func (_ context.Context , container string , options dockertypes. ContainerStartOptions ) error
28
+ ContainerStartFn func (_ context.Context , container string , options containertypes. StartOptions ) error
28
29
ContainerExecAttachFn func (_ context.Context , execID string , config dockertypes.ExecStartCheck ) (dockertypes.HijackedResponse , error )
29
30
ContainerExecCreateFn func (_ context.Context , container string , config dockertypes.ExecConfig ) (dockertypes.IDResponse , error )
30
31
ContainerExecStartFn func (_ context.Context , execID string , config dockertypes.ExecStartCheck ) error
31
32
ContainerExecInspectFn func (_ context.Context , execID string ) (dockertypes.ContainerExecInspect , error )
32
33
ContainerInspectFn func (_ context.Context , container string ) (dockertypes.ContainerJSON , error )
33
- ContainerRemoveFn func (_ context.Context , container string , options dockertypes. ContainerRemoveOptions ) error
34
+ ContainerRemoveFn func (_ context.Context , container string , options containertypes. RemoveOptions ) error
34
35
PingFn func (_ context.Context ) (dockertypes.Ping , error )
35
36
}
36
37
@@ -46,42 +47,42 @@ func (MockClient) BuildCancel(_ context.Context, _ string) error {
46
47
panic ("not implemented" )
47
48
}
48
49
49
- func (MockClient ) ImageCreate (_ context.Context , _ string , _ dockertypes. ImageCreateOptions ) (io.ReadCloser , error ) {
50
+ func (MockClient ) ImageCreate (_ context.Context , _ string , _ image. CreateOptions ) (io.ReadCloser , error ) {
50
51
panic ("not implemented" )
51
52
}
52
53
53
54
func (MockClient ) ImageHistory (_ context.Context , _ string ) ([]image.HistoryResponseItem , error ) {
54
55
panic ("not implemented" )
55
56
}
56
57
57
- func (MockClient ) ImageImport (_ context.Context , _ dockertypes. ImageImportSource , _ string , _ dockertypes. ImageImportOptions ) (io.ReadCloser , error ) {
58
+ func (MockClient ) ImageImport (_ context.Context , _ image. ImportSource , _ string , _ image. ImportOptions ) (io.ReadCloser , error ) {
58
59
panic ("not implemented" )
59
60
}
60
61
61
62
func (MockClient ) ImageInspectWithRaw (_ context.Context , _ string ) (dockertypes.ImageInspect , []byte , error ) {
62
63
panic ("not implemented" )
63
64
}
64
65
65
- func (MockClient ) ImageList (_ context.Context , _ dockertypes. ImageListOptions ) ([]dockertypes. ImageSummary , error ) {
66
+ func (MockClient ) ImageList (_ context.Context , _ image. ListOptions ) ([]image. Summary , error ) {
66
67
panic ("not implemented" )
67
68
}
68
69
69
70
func (MockClient ) ImageLoad (_ context.Context , _ io.Reader , _ bool ) (dockertypes.ImageLoadResponse , error ) {
70
71
panic ("not implemented" )
71
72
}
72
73
73
- func (m MockClient ) ImagePull (ctx context.Context , ref string , options dockertypes. ImagePullOptions ) (io.ReadCloser , error ) {
74
+ func (m MockClient ) ImagePull (ctx context.Context , ref string , options image. PullOptions ) (io.ReadCloser , error ) {
74
75
if m .ImagePullFn == nil {
75
76
return io .NopCloser (strings .NewReader ("" )), nil
76
77
}
77
78
return m .ImagePullFn (ctx , ref , options )
78
79
}
79
80
80
- func (MockClient ) ImagePush (_ context.Context , _ string , _ dockertypes. ImagePushOptions ) (io.ReadCloser , error ) {
81
+ func (MockClient ) ImagePush (_ context.Context , _ string , _ image. PushOptions ) (io.ReadCloser , error ) {
81
82
panic ("not implemented" )
82
83
}
83
84
84
- func (MockClient ) ImageRemove (_ context.Context , _ string , _ dockertypes. ImageRemoveOptions ) ([]dockertypes. ImageDeleteResponseItem , error ) {
85
+ func (MockClient ) ImageRemove (_ context.Context , _ string , _ image. RemoveOptions ) ([]image. DeleteResponse , error ) {
85
86
panic ("not implemented" )
86
87
}
87
88
@@ -108,11 +109,11 @@ func (MockClient) Events(_ context.Context, _ dockertypes.EventsOptions) (<-chan
108
109
panic ("not implemented" )
109
110
}
110
111
111
- func (MockClient ) Info (_ context.Context ) (dockertypes .Info , error ) {
112
+ func (MockClient ) Info (_ context.Context ) (system .Info , error ) {
112
113
panic ("not implemented" )
113
114
}
114
115
115
- func (MockClient ) RegistryLogin (_ context.Context , _ dockertypes .AuthConfig ) (registry.AuthenticateOKBody , error ) {
116
+ func (MockClient ) RegistryLogin (_ context.Context , _ registry .AuthConfig ) (registry.AuthenticateOKBody , error ) {
116
117
panic ("not implemented" )
117
118
}
118
119
@@ -127,11 +128,11 @@ func (m MockClient) Ping(ctx context.Context) (dockertypes.Ping, error) {
127
128
return m .PingFn (ctx )
128
129
}
129
130
130
- func (MockClient ) ContainerAttach (_ context.Context , _ string , _ dockertypes. ContainerAttachOptions ) (dockertypes.HijackedResponse , error ) {
131
+ func (MockClient ) ContainerAttach (_ context.Context , _ string , _ containertypes. AttachOptions ) (dockertypes.HijackedResponse , error ) {
131
132
panic ("not implemented" )
132
133
}
133
134
134
- func (MockClient ) ContainerCommit (_ context.Context , _ string , _ dockertypes. ContainerCommitOptions ) (dockertypes.IDResponse , error ) {
135
+ func (MockClient ) ContainerCommit (_ context.Context , _ string , _ containertypes. CommitOptions ) (dockertypes.IDResponse , error ) {
135
136
panic ("not implemented" )
136
137
}
137
138
@@ -142,7 +143,7 @@ func (m MockClient) ContainerCreate(ctx context.Context, config *containertypes.
142
143
return m .ContainerCreateFn (ctx , config , hostConfig , networkingConfig , pspecs , containerName )
143
144
}
144
145
145
- func (MockClient ) ContainerDiff (_ context.Context , _ string ) ([]containertypes.ContainerChangeResponseItem , error ) {
146
+ func (MockClient ) ContainerDiff (_ context.Context , _ string ) ([]containertypes.FilesystemChange , error ) {
146
147
panic ("not implemented" )
147
148
}
148
149
@@ -168,7 +169,7 @@ func (m MockClient) ContainerExecInspect(ctx context.Context, id string) (docker
168
169
return m .ContainerExecInspectFn (ctx , id )
169
170
}
170
171
171
- func (MockClient ) ContainerExecResize (_ context.Context , _ string , _ dockertypes .ResizeOptions ) error {
172
+ func (MockClient ) ContainerExecResize (_ context.Context , _ string , _ containertypes .ResizeOptions ) error {
172
173
panic ("not implemented" )
173
174
}
174
175
@@ -198,19 +199,19 @@ func (MockClient) ContainerKill(_ context.Context, _ string, _ string) error {
198
199
panic ("not implemented" )
199
200
}
200
201
201
- func (MockClient ) ContainerList (_ context.Context , _ dockertypes. ContainerListOptions ) ([]dockertypes.Container , error ) {
202
+ func (MockClient ) ContainerList (_ context.Context , _ containertypes. ListOptions ) ([]dockertypes.Container , error ) {
202
203
panic ("not implemented" )
203
204
}
204
205
205
- func (MockClient ) ContainerLogs (_ context.Context , _ string , _ dockertypes. ContainerLogsOptions ) (io.ReadCloser , error ) {
206
+ func (MockClient ) ContainerLogs (_ context.Context , _ string , _ containertypes. LogsOptions ) (io.ReadCloser , error ) {
206
207
panic ("not implemented" )
207
208
}
208
209
209
210
func (MockClient ) ContainerPause (_ context.Context , _ string ) error {
210
211
panic ("not implemented" )
211
212
}
212
213
213
- func (m MockClient ) ContainerRemove (ctx context.Context , name string , options dockertypes. ContainerRemoveOptions ) error {
214
+ func (m MockClient ) ContainerRemove (ctx context.Context , name string , options containertypes. RemoveOptions ) error {
214
215
if m .ContainerRemoveFn == nil {
215
216
return nil
216
217
}
@@ -221,7 +222,7 @@ func (MockClient) ContainerRename(_ context.Context, _ string, _ string) error {
221
222
panic ("not implemented" )
222
223
}
223
224
224
- func (MockClient ) ContainerResize (_ context.Context , _ string , _ dockertypes .ResizeOptions ) error {
225
+ func (MockClient ) ContainerResize (_ context.Context , _ string , _ containertypes .ResizeOptions ) error {
225
226
panic ("not implemented" )
226
227
}
227
228
@@ -237,7 +238,7 @@ func (MockClient) ContainerStats(_ context.Context, _ string, _ bool) (dockertyp
237
238
panic ("not implemented" )
238
239
}
239
240
240
- func (m MockClient ) ContainerStart (ctx context.Context , name string , options dockertypes. ContainerStartOptions ) error {
241
+ func (m MockClient ) ContainerStart (ctx context.Context , name string , options containertypes. StartOptions ) error {
241
242
if m .ContainerStartFn == nil {
242
243
return nil
243
244
}
0 commit comments