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:
@ -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))
|
||||
|
Reference in New Issue
Block a user