mirror of
https://github.com/docker/docs.git
synced 2026-03-28 23:08:49 +07:00
Merge pull request #15023 from hqhq/hq_add_status_in_inspect
Add status string to State field for inspect
This commit is contained in:
@@ -49,6 +49,38 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
||||
dockerCmd(c, "inspect", "busybox")
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out = strings.TrimSpace(out)
|
||||
|
||||
inspectOut, err := inspectField(out, "State.Status")
|
||||
c.Assert(err, check.IsNil)
|
||||
if inspectOut != "running" {
|
||||
c.Fatalf("inspect got wrong status, got: %q, expected: running", inspectOut)
|
||||
}
|
||||
|
||||
dockerCmd(c, "pause", out)
|
||||
inspectOut, err = inspectField(out, "State.Status")
|
||||
c.Assert(err, check.IsNil)
|
||||
if inspectOut != "paused" {
|
||||
c.Fatalf("inspect got wrong status, got: %q, expected: paused", inspectOut)
|
||||
}
|
||||
|
||||
dockerCmd(c, "unpause", out)
|
||||
inspectOut, err = inspectField(out, "State.Status")
|
||||
c.Assert(err, check.IsNil)
|
||||
if inspectOut != "running" {
|
||||
c.Fatalf("inspect got wrong status, got: %q, expected: running", inspectOut)
|
||||
}
|
||||
|
||||
dockerCmd(c, "stop", out)
|
||||
inspectOut, err = inspectField(out, "State.Status")
|
||||
c.Assert(err, check.IsNil)
|
||||
if inspectOut != "exited" {
|
||||
c.Fatalf("inspect got wrong status, got: %q, expected: exited", inspectOut)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
|
||||
|
||||
//Both the container and image are named busybox. docker inspect will fetch container
|
||||
|
||||
Reference in New Issue
Block a user