@@ -6,13 +6,15 @@ import (
66 "strings"
77
88 dockertypes "github.com/docker/docker/api/types"
9+ "github.com/docker/docker/api/types/common"
910 containertypes "github.com/docker/docker/api/types/container"
1011 "github.com/docker/docker/api/types/events"
1112 "github.com/docker/docker/api/types/filters"
1213 "github.com/docker/docker/api/types/image"
1314 networktypes "github.com/docker/docker/api/types/network"
1415 "github.com/docker/docker/api/types/registry"
1516 "github.com/docker/docker/api/types/system"
17+ dockerclient "github.com/docker/docker/client"
1618 specs "github.com/opencontainers/image-spec/specs-go/v1"
1719
1820 "github.com/coder/envbox/dockerutil"
@@ -24,12 +26,12 @@ var _ dockerutil.Client = MockClient{}
2426type MockClient struct {
2527 ImagePullFn func (_ context.Context , ref string , options image.PullOptions ) (io.ReadCloser , error )
2628 ContainerCreateFn func (_ context.Context , config * containertypes.Config , hostConfig * containertypes.HostConfig , networkingConfig * networktypes.NetworkingConfig , _ * specs.Platform , containerName string ) (containertypes.CreateResponse , error )
27- ImagePruneFn func (_ context.Context , pruneFilter filters.Args ) (dockertypes. ImagesPruneReport , error )
29+ ImagePruneFn func (_ context.Context , pruneFilter filters.Args ) (image. PruneReport , error )
2830 ContainerStartFn func (_ context.Context , container string , options containertypes.StartOptions ) error
29- ContainerExecAttachFn func (_ context.Context , execID string , config dockertypes. ExecStartCheck ) (dockertypes.HijackedResponse , error )
30- ContainerExecCreateFn func (_ context.Context , container string , config dockertypes. ExecConfig ) (dockertypes .IDResponse , error )
31- ContainerExecStartFn func (_ context.Context , execID string , config dockertypes. ExecStartCheck ) error
32- ContainerExecInspectFn func (_ context.Context , execID string ) (dockertypes. ContainerExecInspect , error )
31+ ContainerExecAttachFn func (_ context.Context , execID string , config containertypes. ExecAttachOptions ) (dockertypes.HijackedResponse , error )
32+ ContainerExecCreateFn func (_ context.Context , container string , config containertypes. ExecOptions ) (common .IDResponse , error )
33+ ContainerExecStartFn func (_ context.Context , execID string , config containertypes. ExecAttachOptions ) error
34+ ContainerExecInspectFn func (_ context.Context , execID string ) (containertypes. ExecInspect , error )
3335 ContainerInspectFn func (_ context.Context , container string ) (dockertypes.ContainerJSON , error )
3436 ContainerRemoveFn func (_ context.Context , container string , options containertypes.RemoveOptions ) error
3537 PingFn func (_ context.Context ) (dockertypes.Ping , error )
@@ -51,23 +53,27 @@ func (MockClient) ImageCreate(_ context.Context, _ string, _ image.CreateOptions
5153 panic ("not implemented" )
5254}
5355
54- func (MockClient ) ImageHistory (_ context.Context , _ string ) ([]image.HistoryResponseItem , error ) {
56+ func (MockClient ) ImageHistory (_ context.Context , _ string , _ ... dockerclient. ImageHistoryOption ) ([]image.HistoryResponseItem , error ) {
5557 panic ("not implemented" )
5658}
5759
5860func (MockClient ) ImageImport (_ context.Context , _ image.ImportSource , _ string , _ image.ImportOptions ) (io.ReadCloser , error ) {
5961 panic ("not implemented" )
6062}
6163
62- func (MockClient ) ImageInspectWithRaw (_ context.Context , _ string ) (dockertypes.ImageInspect , []byte , error ) {
64+ func (MockClient ) ImageInspect (_ context.Context , _ string , _ ... dockerclient.ImageInspectOption ) (image.InspectResponse , error ) {
65+ panic ("not implemented" )
66+ }
67+
68+ func (MockClient ) ImageInspectWithRaw (_ context.Context , _ string ) (image.InspectResponse , []byte , error ) {
6369 panic ("not implemented" )
6470}
6571
6672func (MockClient ) ImageList (_ context.Context , _ image.ListOptions ) ([]image.Summary , error ) {
6773 panic ("not implemented" )
6874}
6975
70- func (MockClient ) ImageLoad (_ context.Context , _ io.Reader , _ bool ) (dockertypes. ImageLoadResponse , error ) {
76+ func (MockClient ) ImageLoad (_ context.Context , _ io.Reader , _ ... dockerclient. ImageLoadOption ) (image. LoadResponse , error ) {
7177 panic ("not implemented" )
7278}
7379
@@ -86,26 +92,26 @@ func (MockClient) ImageRemove(_ context.Context, _ string, _ image.RemoveOptions
8692 panic ("not implemented" )
8793}
8894
89- func (MockClient ) ImageSearch (_ context.Context , _ string , _ dockertypes. ImageSearchOptions ) ([]registry.SearchResult , error ) {
95+ func (MockClient ) ImageSearch (_ context.Context , _ string , _ registry. SearchOptions ) ([]registry.SearchResult , error ) {
9096 panic ("not implemented" )
9197}
9298
93- func (MockClient ) ImageSave (_ context.Context , _ []string ) (io.ReadCloser , error ) {
99+ func (MockClient ) ImageSave (_ context.Context , _ []string , _ ... dockerclient. ImageSaveOption ) (io.ReadCloser , error ) {
94100 panic ("not implemented" )
95101}
96102
97103func (MockClient ) ImageTag (_ context.Context , _ string , _ string ) error {
98104 panic ("not implemented" )
99105}
100106
101- func (m MockClient ) ImagesPrune (ctx context.Context , pruneFilter filters.Args ) (dockertypes. ImagesPruneReport , error ) {
107+ func (m MockClient ) ImagesPrune (ctx context.Context , pruneFilter filters.Args ) (image. PruneReport , error ) {
102108 if m .ImagePruneFn == nil {
103- return dockertypes. ImagesPruneReport {}, nil
109+ return image. PruneReport {}, nil
104110 }
105111 return m .ImagePruneFn (ctx , pruneFilter )
106112}
107113
108- func (MockClient ) Events (_ context.Context , _ dockertypes. EventsOptions ) (<- chan events.Message , <- chan error ) {
114+ func (MockClient ) Events (_ context.Context , _ events. ListOptions ) (<- chan events.Message , <- chan error ) {
109115 panic ("not implemented" )
110116}
111117
@@ -147,23 +153,23 @@ func (MockClient) ContainerDiff(_ context.Context, _ string) ([]containertypes.F
147153 panic ("not implemented" )
148154}
149155
150- func (m MockClient ) ContainerExecAttach (ctx context.Context , execID string , config dockertypes. ExecStartCheck ) (dockertypes.HijackedResponse , error ) {
156+ func (m MockClient ) ContainerExecAttach (ctx context.Context , execID string , config containertypes. ExecAttachOptions ) (dockertypes.HijackedResponse , error ) {
151157 if m .ContainerExecAttachFn == nil {
152158 return dockertypes.HijackedResponse {}, nil
153159 }
154160 return m .ContainerExecAttachFn (ctx , execID , config )
155161}
156162
157- func (m MockClient ) ContainerExecCreate (ctx context.Context , name string , config dockertypes. ExecConfig ) (dockertypes .IDResponse , error ) {
163+ func (m MockClient ) ContainerExecCreate (ctx context.Context , name string , config containertypes. ExecOptions ) (common .IDResponse , error ) {
158164 if m .ContainerExecCreateFn == nil {
159- return dockertypes .IDResponse {}, nil
165+ return common .IDResponse {}, nil
160166 }
161167 return m .ContainerExecCreateFn (ctx , name , config )
162168}
163169
164- func (m MockClient ) ContainerExecInspect (ctx context.Context , id string ) (dockertypes. ContainerExecInspect , error ) {
170+ func (m MockClient ) ContainerExecInspect (ctx context.Context , id string ) (containertypes. ExecInspect , error ) {
165171 if m .ContainerExecInspectFn == nil {
166- return dockertypes. ContainerExecInspect {
172+ return containertypes. ExecInspect {
167173 Pid : 123 ,
168174 }, nil
169175 }
@@ -175,7 +181,7 @@ func (MockClient) ContainerExecResize(_ context.Context, _ string, _ containerty
175181 panic ("not implemented" )
176182}
177183
178- func (m MockClient ) ContainerExecStart (ctx context.Context , execID string , config dockertypes. ExecStartCheck ) error {
184+ func (m MockClient ) ContainerExecStart (ctx context.Context , execID string , config containertypes. ExecAttachOptions ) error {
179185 if m .ContainerExecStartFn == nil {
180186 return nil
181187 }
@@ -201,7 +207,7 @@ func (MockClient) ContainerKill(_ context.Context, _ string, _ string) error {
201207 panic ("not implemented" )
202208}
203209
204- func (MockClient ) ContainerList (_ context.Context , _ containertypes.ListOptions ) ([]dockertypes. Container , error ) {
210+ func (MockClient ) ContainerList (_ context.Context , _ containertypes.ListOptions ) ([]containertypes. Summary , error ) {
205211 panic ("not implemented" )
206212}
207213
@@ -232,11 +238,11 @@ func (MockClient) ContainerRestart(_ context.Context, _ string, _ containertypes
232238 panic ("not implemented" )
233239}
234240
235- func (MockClient ) ContainerStatPath (_ context.Context , _ string , _ string ) (dockertypes. ContainerPathStat , error ) {
241+ func (MockClient ) ContainerStatPath (_ context.Context , _ string , _ string ) (containertypes. PathStat , error ) {
236242 panic ("not implemented" )
237243}
238244
239- func (MockClient ) ContainerStats (_ context.Context , _ string , _ bool ) (dockertypes. ContainerStats , error ) {
245+ func (MockClient ) ContainerStats (_ context.Context , _ string , _ bool ) (containertypes. StatsResponseReader , error ) {
240246 panic ("not implemented" )
241247}
242248
@@ -267,18 +273,18 @@ func (MockClient) ContainerWait(_ context.Context, _ string, _ containertypes.Wa
267273 panic ("not implemented" )
268274}
269275
270- func (MockClient ) CopyFromContainer (_ context.Context , _ string , _ string ) (io.ReadCloser , dockertypes. ContainerPathStat , error ) {
276+ func (MockClient ) CopyFromContainer (_ context.Context , _ string , _ string ) (io.ReadCloser , containertypes. PathStat , error ) {
271277 panic ("not implemented" )
272278}
273279
274- func (MockClient ) CopyToContainer (_ context.Context , _ string , _ string , _ io.Reader , _ dockertypes .CopyToContainerOptions ) error {
280+ func (MockClient ) CopyToContainer (_ context.Context , _ string , _ string , _ io.Reader , _ containertypes .CopyToContainerOptions ) error {
275281 panic ("not implemented" )
276282}
277283
278- func (MockClient ) ContainersPrune (_ context.Context , _ filters.Args ) (dockertypes. ContainersPruneReport , error ) {
284+ func (MockClient ) ContainersPrune (_ context.Context , _ filters.Args ) (containertypes. PruneReport , error ) {
279285 panic ("not implemented" )
280286}
281287
282- func (MockClient ) ContainerStatsOneShot (_ context.Context , _ string ) (dockertypes. ContainerStats , error ) {
288+ func (MockClient ) ContainerStatsOneShot (_ context.Context , _ string ) (containertypes. StatsResponseReader , error ) {
283289 panic ("not implemented" )
284290}
0 commit comments