From 5a5d39205cad5fe31afc7f24b2a9741b90f1f64f Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Wed, 22 Oct 2025 15:51:27 -0500 Subject: [PATCH] client: rename `ServiceListResult.Services` to `ServiceListResult.Items` Signed-off-by: Austin Vazquez --- client/service_list.go | 4 ++-- client/service_list_test.go | 2 +- integration/network/service_test.go | 4 ++-- integration/service/list_test.go | 8 ++++---- internal/testutil/daemon/service.go | 2 +- vendor/github.com/moby/moby/client/service_list.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/service_list.go b/client/service_list.go index c0fb498588..94b5204be3 100644 --- a/client/service_list.go +++ b/client/service_list.go @@ -19,7 +19,7 @@ type ServiceListOptions struct { // ServiceListResult represents the result of a service list operation. type ServiceListResult struct { - Services []swarm.Service + Items []swarm.Service } // ServiceList returns the list of services. @@ -40,5 +40,5 @@ func (cli *Client) ServiceList(ctx context.Context, options ServiceListOptions) var services []swarm.Service err = json.NewDecoder(resp.Body).Decode(&services) - return ServiceListResult{Services: services}, err + return ServiceListResult{Items: services}, err } diff --git a/client/service_list_test.go b/client/service_list_test.go index 87303ec012..8fd3b543b4 100644 --- a/client/service_list_test.go +++ b/client/service_list_test.go @@ -77,6 +77,6 @@ func TestServiceList(t *testing.T) { list, err := client.ServiceList(context.Background(), listCase.options) assert.NilError(t, err) - assert.Check(t, is.Len(list.Services, 2)) + assert.Check(t, is.Len(list.Items, 2)) } } diff --git a/integration/network/service_test.go b/integration/network/service_test.go index d2cf76de02..7910d98fb7 100644 --- a/integration/network/service_test.go +++ b/integration/network/service_test.go @@ -337,10 +337,10 @@ func noServices(ctx context.Context, apiClient client.ServiceAPIClient) func(log switch { case err != nil: return poll.Error(err) - case len(result.Services) == 0: + case len(result.Items) == 0: return poll.Success() default: - return poll.Continue("waiting for all services to be removed: service count at %d", len(result.Services)) + return poll.Continue("waiting for all services to be removed: service count at %d", len(result.Items)) } } } diff --git a/integration/service/list_test.go b/integration/service/list_test.go index 4d47055ee3..f480b2d1c7 100644 --- a/integration/service/list_test.go +++ b/integration/service/list_test.go @@ -80,16 +80,16 @@ func TestServiceListWithStatuses(t *testing.T) { // now, let's do the list operation with no status arg set. result, err := apiClient.ServiceList(ctx, client.ServiceListOptions{}) assert.NilError(t, err) - assert.Check(t, is.Len(result.Services, serviceCount)) - for _, service := range result.Services { + assert.Check(t, is.Len(result.Items, serviceCount)) + for _, service := range result.Items { assert.Check(t, is.Nil(service.ServiceStatus)) } // now try again, but with Status: true. This time, we should have statuses result, err = apiClient.ServiceList(ctx, client.ServiceListOptions{Status: true}) assert.NilError(t, err) - assert.Check(t, is.Len(result.Services, serviceCount)) - for _, service := range result.Services { + assert.Check(t, is.Len(result.Items, serviceCount)) + for _, service := range result.Items { replicas := *service.Spec.Mode.Replicated.Replicas assert.Assert(t, service.ServiceStatus != nil) diff --git a/internal/testutil/daemon/service.go b/internal/testutil/daemon/service.go index 3c394c897a..105ec9d607 100644 --- a/internal/testutil/daemon/service.go +++ b/internal/testutil/daemon/service.go @@ -107,7 +107,7 @@ func (d *Daemon) ListServices(ctx context.Context, t testing.TB) []swarm.Service res, err := cli.ServiceList(ctx, client.ServiceListOptions{}) assert.NilError(t, err) - return res.Services + return res.Items } // GetTask returns the swarm task identified by the specified id diff --git a/vendor/github.com/moby/moby/client/service_list.go b/vendor/github.com/moby/moby/client/service_list.go index c0fb498588..94b5204be3 100644 --- a/vendor/github.com/moby/moby/client/service_list.go +++ b/vendor/github.com/moby/moby/client/service_list.go @@ -19,7 +19,7 @@ type ServiceListOptions struct { // ServiceListResult represents the result of a service list operation. type ServiceListResult struct { - Services []swarm.Service + Items []swarm.Service } // ServiceList returns the list of services. @@ -40,5 +40,5 @@ func (cli *Client) ServiceList(ctx context.Context, options ServiceListOptions) var services []swarm.Service err = json.NewDecoder(resp.Body).Decode(&services) - return ServiceListResult{Services: services}, err + return ServiceListResult{Items: services}, err }