@@ -7,30 +7,39 @@ import (
77 "github.com/docker/docker/api/types/container"
88 "github.com/docker/docker/api/types/events"
99 "github.com/docker/docker/api/types/filters"
10+ "github.com/docker/docker/api/types/image"
1011 "github.com/docker/docker/api/types/network"
12+ "github.com/docker/docker/api/types/swarm"
13+ "github.com/docker/docker/api/types/system"
14+ "github.com/docker/docker/api/types/volume"
1115 "github.com/docker/docker/client"
1216)
1317
1418type fakeClient struct {
1519 client.Client
1620
1721 version string
18- serverVersion func (ctx context.Context ) (types.Version , error )
19- eventsFn func (context.Context , events.ListOptions ) (<- chan events.Message , <- chan error )
22+ containerListFunc func (context.Context , container.ListOptions ) ([]container.Summary , error )
2023 containerPruneFunc func (ctx context.Context , pruneFilters filters.Args ) (container.PruneReport , error )
24+ eventsFn func (context.Context , events.ListOptions ) (<- chan events.Message , <- chan error )
25+ imageListFunc func (ctx context.Context , options image.ListOptions ) ([]image.Summary , error )
26+ infoFunc func (ctx context.Context ) (system.Info , error )
27+ networkListFunc func (ctx context.Context , options network.ListOptions ) ([]network.Summary , error )
2128 networkPruneFunc func (ctx context.Context , pruneFilter filters.Args ) (network.PruneReport , error )
22- }
23-
24- func (cli * fakeClient ) ServerVersion (ctx context.Context ) (types.Version , error ) {
25- return cli .serverVersion (ctx )
29+ nodeListFunc func (ctx context.Context , options types.NodeListOptions ) ([]swarm.Node , error )
30+ serverVersion func (ctx context.Context ) (types.Version , error )
31+ volumeListFunc func (ctx context.Context , options volume.ListOptions ) (volume.ListResponse , error )
2632}
2733
2834func (cli * fakeClient ) ClientVersion () string {
2935 return cli .version
3036}
3137
32- func (cli * fakeClient ) Events (ctx context.Context , opts events.ListOptions ) (<- chan events.Message , <- chan error ) {
33- return cli .eventsFn (ctx , opts )
38+ func (cli * fakeClient ) ContainerList (ctx context.Context , options container.ListOptions ) ([]container.Summary , error ) {
39+ if cli .containerListFunc != nil {
40+ return cli .containerListFunc (ctx , options )
41+ }
42+ return []container.Summary {}, nil
3443}
3544
3645func (cli * fakeClient ) ContainersPrune (ctx context.Context , pruneFilters filters.Args ) (container.PruneReport , error ) {
@@ -40,9 +49,52 @@ func (cli *fakeClient) ContainersPrune(ctx context.Context, pruneFilters filters
4049 return container.PruneReport {}, nil
4150}
4251
52+ func (cli * fakeClient ) Events (ctx context.Context , opts events.ListOptions ) (<- chan events.Message , <- chan error ) {
53+ return cli .eventsFn (ctx , opts )
54+ }
55+
56+ func (cli * fakeClient ) ImageList (ctx context.Context , options image.ListOptions ) ([]image.Summary , error ) {
57+ if cli .imageListFunc != nil {
58+ return cli .imageListFunc (ctx , options )
59+ }
60+ return []image.Summary {}, nil
61+ }
62+
63+ func (cli * fakeClient ) Info (ctx context.Context ) (system.Info , error ) {
64+ if cli .infoFunc != nil {
65+ return cli .infoFunc (ctx )
66+ }
67+ return system.Info {}, nil
68+ }
69+
70+ func (cli * fakeClient ) NetworkList (ctx context.Context , options network.ListOptions ) ([]network.Summary , error ) {
71+ if cli .networkListFunc != nil {
72+ return cli .networkListFunc (ctx , options )
73+ }
74+ return []network.Summary {}, nil
75+ }
76+
4377func (cli * fakeClient ) NetworksPrune (ctx context.Context , pruneFilter filters.Args ) (network.PruneReport , error ) {
4478 if cli .networkPruneFunc != nil {
4579 return cli .networkPruneFunc (ctx , pruneFilter )
4680 }
4781 return network.PruneReport {}, nil
4882}
83+
84+ func (cli * fakeClient ) NodeList (ctx context.Context , options types.NodeListOptions ) ([]swarm.Node , error ) {
85+ if cli .nodeListFunc != nil {
86+ return cli .nodeListFunc (ctx , options )
87+ }
88+ return []swarm.Node {}, nil
89+ }
90+
91+ func (cli * fakeClient ) ServerVersion (ctx context.Context ) (types.Version , error ) {
92+ return cli .serverVersion (ctx )
93+ }
94+
95+ func (cli * fakeClient ) VolumeList (ctx context.Context , options volume.ListOptions ) (volume.ListResponse , error ) {
96+ if cli .volumeListFunc != nil {
97+ return cli .volumeListFunc (ctx , options )
98+ }
99+ return volume.ListResponse {}, nil
100+ }
0 commit comments