From 28cff4b06d40ee80df74f5d51e137a6409501cc7 Mon Sep 17 00:00:00 2001 From: Michael Wan Date: Tue, 15 May 2018 09:24:45 -0400 Subject: [PATCH] bugfix: ExecIDs should be a slice Signed-off-by: Michael Wan --- apis/swagger.yml | 5 ++++- apis/types/container_json.go | 18 ++++++++++++++++-- test/cli_ps_test.go | 6 +++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/apis/swagger.yml b/apis/swagger.yml index ac3aa9147..5aa316cb4 100644 --- a/apis/swagger.yml +++ b/apis/swagger.yml @@ -2894,7 +2894,10 @@ definitions: AppArmorProfile: type: "string" ExecIDs: - type: "string" + description: "exec ids of container" + type: "array" + items: + type: "string" HostConfig: $ref: "#/definitions/HostConfig" SizeRw: diff --git a/apis/types/container_json.go b/apis/types/container_json.go index 20671e588..20d0372a9 100644 --- a/apis/types/container_json.go +++ b/apis/types/container_json.go @@ -34,8 +34,8 @@ type ContainerJSON struct { // driver Driver string `json:"Driver,omitempty"` - // exec ids - ExecIds string `json:"ExecIDs,omitempty"` + // exec ids of container + ExecIds []string `json:"ExecIDs"` // graph driver GraphDriver *GraphDriverData `json:"GraphDriver,omitempty"` @@ -159,6 +159,11 @@ func (m *ContainerJSON) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateExecIds(formats); err != nil { + // prop + res = append(res, err) + } + if err := m.validateGraphDriver(formats); err != nil { // prop res = append(res, err) @@ -218,6 +223,15 @@ func (m *ContainerJSON) validateConfig(formats strfmt.Registry) error { return nil } +func (m *ContainerJSON) validateExecIds(formats strfmt.Registry) error { + + if swag.IsZero(m.ExecIds) { // not required + return nil + } + + return nil +} + func (m *ContainerJSON) validateGraphDriver(formats strfmt.Registry) error { if swag.IsZero(m.GraphDriver) { // not required diff --git a/test/cli_ps_test.go b/test/cli_ps_test.go index 38ee7a9c9..e03261cea 100644 --- a/test/cli_ps_test.go +++ b/test/cli_ps_test.go @@ -76,7 +76,7 @@ func (suite *PouchPsSuite) TestPsWorks(c *check.C) { func (suite *PouchPsSuite) TestPsAll(c *check.C) { name := "ps-all" - command.PouchRun("create", "--name", name, busyboxImage).Assert(c, icmd.Success) + command.PouchRun("create", "--name", name, busyboxImage, "top").Assert(c, icmd.Success) defer DelContainerForceMultyTime(c, name) res := command.PouchRun("ps").Assert(c, icmd.Success) @@ -95,7 +95,7 @@ func (suite *PouchPsSuite) TestPsAll(c *check.C) { func (suite *PouchPsSuite) TestPsQuiet(c *check.C) { name := "ps-quiet" - command.PouchRun("create", "--name", name, busyboxImage).Assert(c, icmd.Success) + command.PouchRun("create", "--name", name, busyboxImage, "top").Assert(c, icmd.Success) defer DelContainerForceMultyTime(c, name) res := command.PouchRun("ps", "-q", "-a").Assert(c, icmd.Success) @@ -113,7 +113,7 @@ func (suite *PouchPsSuite) TestPsQuiet(c *check.C) { func (suite *PouchPsSuite) TestPsNoTrunc(c *check.C) { name := "ps-noTrunc" - command.PouchRun("create", "--name", name, busyboxImage).Assert(c, icmd.Success) + command.PouchRun("create", "--name", name, busyboxImage, "top").Assert(c, icmd.Success) defer DelContainerForceMultyTime(c, name) command.PouchRun("start", name).Assert(c, icmd.Success)