@@ -32,14 +32,22 @@ func mockContainerLogsResult(content string) client.ContainerLogsResult {
3232 return out
3333}
3434
35+ type fakeStreamResult struct {
36+ io.ReadCloser
37+ client.ImagePushResponse // same interface as [client.ImagePushResponse]
38+ }
39+
40+ func (e fakeStreamResult ) Read (p []byte ) (int , error ) { return e .ReadCloser .Read (p ) }
41+ func (e fakeStreamResult ) Close () error { return e .ReadCloser .Close () }
42+
3543type fakeClient struct {
3644 client.Client
3745 inspectFunc func (string ) (client.ContainerInspectResult , error )
3846 execInspectFunc func (execID string ) (client.ExecInspectResult , error )
3947 execCreateFunc func (containerID string , options client.ExecCreateOptions ) (client.ExecCreateResult , error )
4048 createContainerFunc func (options client.ContainerCreateOptions ) (client.ContainerCreateResult , error )
4149 containerStartFunc func (containerID string , options client.ContainerStartOptions ) (client.ContainerStartResult , error )
42- imageCreateFunc func (ctx context.Context , parentReference string , options client.ImageCreateOptions ) (client.ImageCreateResult , error )
50+ imagePullFunc func (ctx context.Context , parentReference string , options client.ImagePullOptions ) (client.ImagePullResponse , error )
4351 infoFunc func () (client.SystemInfoResult , error )
4452 containerStatPathFunc func (containerID , path string ) (client.ContainerStatPathResult , error )
4553 containerCopyFromFunc func (containerID , srcPath string ) (client.CopyFromContainerResult , error )
@@ -107,11 +115,11 @@ func (f *fakeClient) ContainerRemove(ctx context.Context, containerID string, op
107115 return client.ContainerRemoveResult {}, nil
108116}
109117
110- func (f * fakeClient ) ImageCreate (ctx context.Context , parentReference string , options client.ImageCreateOptions ) (client.ImageCreateResult , error ) {
111- if f .imageCreateFunc != nil {
112- return f .imageCreateFunc (ctx , parentReference , options )
118+ func (f * fakeClient ) ImagePull (ctx context.Context , parentReference string , options client.ImagePullOptions ) (client.ImagePullResponse , error ) {
119+ if f .imagePullFunc != nil {
120+ return f .imagePullFunc (ctx , parentReference , options )
113121 }
114- return client. ImageCreateResult {}, nil
122+ return fakeStreamResult {}, nil
115123}
116124
117125func (f * fakeClient ) Info (context.Context , client.InfoOptions ) (client.SystemInfoResult , error ) {
0 commit comments