1
0
mirror of https://github.com/moby/moby.git synced 2025-07-30 18:23:29 +03:00

Change "service inspect" to show defaults in place of empty fields

This adds a new parameter insertDefaults to /services/{id}. When this is
set, an empty field (such as UpdateConfig) will be populated with
default values in the API response. Make "service inspect" use this, so
that empty fields do not result in missing information when inspecting a
service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
Aaron Lehmann
2017-03-30 17:15:54 -07:00
parent 5b1cae2271
commit 1d274e9acf
20 changed files with 81 additions and 30 deletions

View File

@ -60,6 +60,16 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *check.C) {
id := d.CreateService(c, simpleTestService, setInstances(instances))
waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, instances)
// insertDefaults inserts UpdateConfig when service is fetched by ID
_, out, err := d.SockRequest("GET", "/services/"+id+"?insertDefaults=true", nil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(string(out), checker.Contains, "UpdateConfig")
// insertDefaults inserts UpdateConfig when service is fetched by ID
_, out, err = d.SockRequest("GET", "/services/top?insertDefaults=true", nil)
c.Assert(err, checker.IsNil, check.Commentf("%s", out))
c.Assert(string(out), checker.Contains, "UpdateConfig")
service := d.GetService(c, id)
instances = 5
d.UpdateService(c, service, setInstances(instances))