From 5209bb7f759024ad89be0bc2729c20d67dc8b63b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 20 Jun 2024 14:23:47 +0200 Subject: [PATCH] test/cli: Use APIClient instead of Client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Embed APIClient interface in `fakeClient` instead of the `Client` struct to satisfy the interface. Signed-off-by: Paweł Gronowski --- cli/command/builder/client_test.go | 2 +- cli/command/checkpoint/client_test.go | 2 +- cli/command/cli_test.go | 2 +- cli/command/config/client_test.go | 2 +- cli/command/container/client_test.go | 2 +- cli/command/idresolver/client_test.go | 2 +- cli/command/image/client_test.go | 2 +- cli/command/network/client_test.go | 2 +- cli/command/node/client_test.go | 2 +- cli/command/plugin/client_test.go | 2 +- cli/command/registry/login_test.go | 2 +- cli/command/secret/client_test.go | 2 +- cli/command/service/client_test.go | 2 +- cli/command/stack/client_test.go | 2 +- cli/command/stack/swarm/client_test.go | 2 +- cli/command/swarm/client_test.go | 2 +- cli/command/system/client_test.go | 2 +- cli/command/trust/inspect_pretty_test.go | 2 +- cli/command/volume/client_test.go | 2 +- cli/compose/convert/service_test.go | 2 +- cmd/docker/builder_test.go | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cli/command/builder/client_test.go b/cli/command/builder/client_test.go index 6214dcf30d8b..c3c2b7480b49 100644 --- a/cli/command/builder/client_test.go +++ b/cli/command/builder/client_test.go @@ -8,7 +8,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient builderPruneFunc func(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) } diff --git a/cli/command/checkpoint/client_test.go b/cli/command/checkpoint/client_test.go index 3d4e0d79111e..731d207ae9fd 100644 --- a/cli/command/checkpoint/client_test.go +++ b/cli/command/checkpoint/client_test.go @@ -8,7 +8,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient checkpointCreateFunc func(container string, options checkpoint.CreateOptions) error checkpointDeleteFunc func(container string, options checkpoint.DeleteOptions) error checkpointListFunc func(container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error) diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index f32513d2cf85..cb1f0983659c 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -100,7 +100,7 @@ func TestNewAPIClientFromFlagsWithAPIVersionFromEnv(t *testing.T) { } type fakeClient struct { - client.Client + client.APIClient pingFunc func() (types.Ping, error) version string negotiated bool diff --git a/cli/command/config/client_test.go b/cli/command/config/client_test.go index c3c938a7be76..67e6980130a4 100644 --- a/cli/command/config/client_test.go +++ b/cli/command/config/client_test.go @@ -9,7 +9,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient configCreateFunc func(context.Context, swarm.ConfigSpec) (types.ConfigCreateResponse, error) configInspectFunc func(context.Context, string) (swarm.Config, []byte, error) configListFunc func(context.Context, types.ConfigListOptions) ([]swarm.Config, error) diff --git a/cli/command/container/client_test.go b/cli/command/container/client_test.go index 621acbcdd097..002f050cecd0 100644 --- a/cli/command/container/client_test.go +++ b/cli/command/container/client_test.go @@ -15,7 +15,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient inspectFunc func(string) (types.ContainerJSON, error) execInspectFunc func(execID string) (container.ExecInspect, error) execCreateFunc func(containerID string, options container.ExecOptions) (types.IDResponse, error) diff --git a/cli/command/idresolver/client_test.go b/cli/command/idresolver/client_test.go index 62049f4257db..e69164b815ae 100644 --- a/cli/command/idresolver/client_test.go +++ b/cli/command/idresolver/client_test.go @@ -9,7 +9,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient nodeInspectFunc func(string) (swarm.Node, []byte, error) serviceInspectFunc func(string) (swarm.Service, []byte, error) } diff --git a/cli/command/image/client_test.go b/cli/command/image/client_test.go index 35bf3ab7729b..1e07d5bf2fa4 100644 --- a/cli/command/image/client_test.go +++ b/cli/command/image/client_test.go @@ -14,7 +14,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient imageTagFunc func(string, string) error imageSaveFunc func(images []string) (io.ReadCloser, error) imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error) diff --git a/cli/command/network/client_test.go b/cli/command/network/client_test.go index aa13a3d09eb4..f5bc16b97048 100644 --- a/cli/command/network/client_test.go +++ b/cli/command/network/client_test.go @@ -9,7 +9,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient networkCreateFunc func(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) networkConnectFunc func(ctx context.Context, networkID, container string, config *network.EndpointSettings) error networkDisconnectFunc func(ctx context.Context, networkID, container string, force bool) error diff --git a/cli/command/node/client_test.go b/cli/command/node/client_test.go index 505d07259ba6..73c9e6ce3c1a 100644 --- a/cli/command/node/client_test.go +++ b/cli/command/node/client_test.go @@ -10,7 +10,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient infoFunc func() (system.Info, error) nodeInspectFunc func() (swarm.Node, []byte, error) nodeListFunc func() ([]swarm.Node, error) diff --git a/cli/command/plugin/client_test.go b/cli/command/plugin/client_test.go index 8eaf06896d2f..10f91be2cebc 100644 --- a/cli/command/plugin/client_test.go +++ b/cli/command/plugin/client_test.go @@ -11,7 +11,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient pluginCreateFunc func(createContext io.Reader, createOptions types.PluginCreateOptions) error pluginDisableFunc func(name string, disableOptions types.PluginDisableOptions) error pluginEnableFunc func(name string, options types.PluginEnableOptions) error diff --git a/cli/command/registry/login_test.go b/cli/command/registry/login_test.go index db88af3117b8..34f9b3aa119d 100644 --- a/cli/command/registry/login_test.go +++ b/cli/command/registry/login_test.go @@ -26,7 +26,7 @@ const ( ) type fakeClient struct { - client.Client + client.APIClient } func (c fakeClient) Info(context.Context) (system.Info, error) { diff --git a/cli/command/secret/client_test.go b/cli/command/secret/client_test.go index efcbccfebacf..8ee794a5de3f 100644 --- a/cli/command/secret/client_test.go +++ b/cli/command/secret/client_test.go @@ -9,7 +9,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient secretCreateFunc func(context.Context, swarm.SecretSpec) (types.SecretCreateResponse, error) secretInspectFunc func(context.Context, string) (swarm.Secret, []byte, error) secretListFunc func(context.Context, types.SecretListOptions) ([]swarm.Secret, error) diff --git a/cli/command/service/client_test.go b/cli/command/service/client_test.go index eeb73a6e4a99..f989c91af7e2 100644 --- a/cli/command/service/client_test.go +++ b/cli/command/service/client_test.go @@ -12,7 +12,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error) diff --git a/cli/command/stack/client_test.go b/cli/command/stack/client_test.go index 7d9072d2de99..879422ed943a 100644 --- a/cli/command/stack/client_test.go +++ b/cli/command/stack/client_test.go @@ -14,7 +14,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient version string diff --git a/cli/command/stack/swarm/client_test.go b/cli/command/stack/swarm/client_test.go index 78f4997c6a90..5ad0303b91dd 100644 --- a/cli/command/stack/swarm/client_test.go +++ b/cli/command/stack/swarm/client_test.go @@ -14,7 +14,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient version string diff --git a/cli/command/swarm/client_test.go b/cli/command/swarm/client_test.go index 9e37db0e60ff..211bec91904d 100644 --- a/cli/command/swarm/client_test.go +++ b/cli/command/swarm/client_test.go @@ -10,7 +10,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient infoFunc func() (system.Info, error) swarmInitFunc func() (string, error) swarmInspectFunc func() (swarm.Swarm, error) diff --git a/cli/command/system/client_test.go b/cli/command/system/client_test.go index b6eeb3bd9294..1c2827da672b 100644 --- a/cli/command/system/client_test.go +++ b/cli/command/system/client_test.go @@ -12,7 +12,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient version string serverVersion func(ctx context.Context) (types.Version, error) diff --git a/cli/command/trust/inspect_pretty_test.go b/cli/command/trust/inspect_pretty_test.go index f564a5f7c631..fa58bbe4644f 100644 --- a/cli/command/trust/inspect_pretty_test.go +++ b/cli/command/trust/inspect_pretty_test.go @@ -26,7 +26,7 @@ import ( // TODO(n4ss): remove common tests with the regular inspect command type fakeClient struct { - client.Client + client.APIClient } func (c *fakeClient) Info(context.Context) (system.Info, error) { diff --git a/cli/command/volume/client_test.go b/cli/command/volume/client_test.go index 81df85807660..dd15fb214cb4 100644 --- a/cli/command/volume/client_test.go +++ b/cli/command/volume/client_test.go @@ -9,7 +9,7 @@ import ( ) type fakeClient struct { - client.Client + client.APIClient volumeCreateFunc func(volume.CreateOptions) (volume.Volume, error) volumeInspectFunc func(volumeID string) (volume.Volume, error) volumeListFunc func(filter filters.Args) (volume.ListResponse, error) diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index 22f585f87c73..a4a4b9a32cd5 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -615,7 +615,7 @@ func TestConvertServiceConfigs(t *testing.T) { } type fakeClient struct { - client.Client + client.APIClient secretListFunc func(types.SecretListOptions) ([]swarm.Secret, error) configListFunc func(types.ConfigListOptions) ([]swarm.Config, error) } diff --git a/cmd/docker/builder_test.go b/cmd/docker/builder_test.go index 7de2572aa2b5..b67058925506 100644 --- a/cmd/docker/builder_test.go +++ b/cmd/docker/builder_test.go @@ -125,7 +125,7 @@ echo '{"SchemaVersion":"0.1.0","Vendor":"Docker Inc.","Version":"v0.6.3","ShortD } type fakeClient struct { - client.Client + client.APIClient } func (c *fakeClient) Ping(_ context.Context) (types.Ping, error) {