mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: rename ServiceListResult.Services to ServiceListResult.Items
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
4
vendor/github.com/moby/moby/client/service_list.go
generated
vendored
4
vendor/github.com/moby/moby/client/service_list.go
generated
vendored
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user