@@ -28,38 +28,38 @@ func (c fakeCLI) Client() client.APIClient {
2828
2929type fakeClient struct {
3030 client.Client
31- containerListFunc func (options client.ContainerListOptions ) ([]container.Summary , error )
32- imageListFunc func (options client.ImageListOptions ) ([]image. Summary , error )
33- networkListFunc func (ctx context.Context , options client.NetworkListOptions ) ([]network. Summary , error )
34- volumeListFunc func (filter client.Filters ) (volume. ListResponse , error )
31+ containerListFunc func (context. Context , client.ContainerListOptions ) ([]container.Summary , error )
32+ imageListFunc func (context. Context , client.ImageListOptions ) (client. ImageListResult , error )
33+ networkListFunc func (context.Context , client.NetworkListOptions ) (client. NetworkListResult , error )
34+ volumeListFunc func (context. Context , client.VolumeListOptions ) (client. VolumeListResult , error )
3535}
3636
37- func (c * fakeClient ) ContainerList (_ context.Context , options client.ContainerListOptions ) ([]container.Summary , error ) {
37+ func (c * fakeClient ) ContainerList (ctx context.Context , options client.ContainerListOptions ) ([]container.Summary , error ) {
3838 if c .containerListFunc != nil {
39- return c .containerListFunc (options )
39+ return c .containerListFunc (ctx , options )
4040 }
4141 return []container.Summary {}, nil
4242}
4343
44- func (c * fakeClient ) ImageList (_ context.Context , options client.ImageListOptions ) ([]image. Summary , error ) {
44+ func (c * fakeClient ) ImageList (ctx context.Context , options client.ImageListOptions ) (client. ImageListResult , error ) {
4545 if c .imageListFunc != nil {
46- return c .imageListFunc (options )
46+ return c .imageListFunc (ctx , options )
4747 }
48- return []image. Summary {}, nil
48+ return client. ImageListResult {}, nil
4949}
5050
51- func (c * fakeClient ) NetworkList (ctx context.Context , options client.NetworkListOptions ) ([]network. Summary , error ) {
51+ func (c * fakeClient ) NetworkList (ctx context.Context , options client.NetworkListOptions ) (client. NetworkListResult , error ) {
5252 if c .networkListFunc != nil {
5353 return c .networkListFunc (ctx , options )
5454 }
55- return []network. Summary {}, nil
55+ return client. NetworkListResult {}, nil
5656}
5757
58- func (c * fakeClient ) VolumeList (_ context.Context , options client.VolumeListOptions ) (volume. ListResponse , error ) {
58+ func (c * fakeClient ) VolumeList (ctx context.Context , options client.VolumeListOptions ) (client. VolumeListResult , error ) {
5959 if c .volumeListFunc != nil {
60- return c .volumeListFunc (options . Filters )
60+ return c .volumeListFunc (ctx , options )
6161 }
62- return volume. ListResponse {}, nil
62+ return client. VolumeListResult {}, nil
6363}
6464
6565func TestCompleteContainerNames (t * testing.T ) {
@@ -153,7 +153,7 @@ func TestCompleteContainerNames(t *testing.T) {
153153 t .Setenv ("DOCKER_COMPLETION_SHOW_CONTAINER_IDS" , "yes" )
154154 }
155155 comp := ContainerNames (fakeCLI {& fakeClient {
156- containerListFunc : func (opts client.ContainerListOptions ) ([]container.Summary , error ) {
156+ containerListFunc : func (_ context. Context , opts client.ContainerListOptions ) ([]container.Summary , error ) {
157157 assert .Check (t , is .DeepEqual (opts , tc .expOpts ))
158158 if tc .expDirective == cobra .ShellCompDirectiveError {
159159 return nil , errors .New ("some error occurred" )
@@ -226,11 +226,11 @@ func TestCompleteImageNames(t *testing.T) {
226226 for _ , tc := range tests {
227227 t .Run (tc .doc , func (t * testing.T ) {
228228 comp := ImageNames (fakeCLI {& fakeClient {
229- imageListFunc : func (options client.ImageListOptions ) ([]image. Summary , error ) {
229+ imageListFunc : func (context. Context , client.ImageListOptions ) (client. ImageListResult , error ) {
230230 if tc .expDirective == cobra .ShellCompDirectiveError {
231- return nil , errors .New ("some error occurred" )
231+ return client. ImageListResult {} , errors .New ("some error occurred" )
232232 }
233- return tc .images , nil
233+ return client. ImageListResult { Items : tc .images } , nil
234234 },
235235 }}, - 1 )
236236
@@ -286,11 +286,11 @@ func TestCompleteNetworkNames(t *testing.T) {
286286 for _ , tc := range tests {
287287 t .Run (tc .doc , func (t * testing.T ) {
288288 comp := NetworkNames (fakeCLI {& fakeClient {
289- networkListFunc : func (ctx context.Context , options client.NetworkListOptions ) ([]network. Summary , error ) {
289+ networkListFunc : func (context.Context , client.NetworkListOptions ) (client. NetworkListResult , error ) {
290290 if tc .expDirective == cobra .ShellCompDirectiveError {
291- return nil , errors .New ("some error occurred" )
291+ return client. NetworkListResult {} , errors .New ("some error occurred" )
292292 }
293- return tc .networks , nil
293+ return client. NetworkListResult { Items : tc .networks } , nil
294294 },
295295 }})
296296
@@ -337,11 +337,11 @@ func TestCompleteVolumeNames(t *testing.T) {
337337 for _ , tc := range tests {
338338 t .Run (tc .doc , func (t * testing.T ) {
339339 comp := VolumeNames (fakeCLI {& fakeClient {
340- volumeListFunc : func (filter client.Filters ) (volume. ListResponse , error ) {
340+ volumeListFunc : func (context. Context , client.VolumeListOptions ) (client. VolumeListResult , error ) {
341341 if tc .expDirective == cobra .ShellCompDirectiveError {
342- return volume. ListResponse {}, errors .New ("some error occurred" )
342+ return client. VolumeListResult {}, errors .New ("some error occurred" )
343343 }
344- return volume.ListResponse {Volumes : tc .volumes }, nil
344+ return client. VolumeListResult { Items : volume.ListResponse {Volumes : tc .volumes } }, nil
345345 },
346346 }})
347347
0 commit comments