mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26172 from Microsoft/jjh/testinspect
Windows: Enable multiple TestInspect tests
This commit is contained in:
commit
a19bdec6f0
1 changed files with 16 additions and 25 deletions
|
@ -36,15 +36,12 @@ func (s *DockerSuite) TestInspectImage(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectInt64(c *check.C) {
|
func (s *DockerSuite) TestInspectInt64(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
|
|
||||||
dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
|
dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
|
||||||
inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory")
|
inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory")
|
||||||
c.Assert(inspectOut, checker.Equals, "314572800")
|
c.Assert(inspectOut, checker.Equals, "314572800")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
//Both the container and image are named busybox. docker inspect will fetch the container JSON.
|
//Both the container and image are named busybox. docker inspect will fetch the container JSON.
|
||||||
//If the container JSON is not available, it will go for the image JSON.
|
//If the container JSON is not available, it will go for the image JSON.
|
||||||
|
|
||||||
|
@ -56,21 +53,26 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
||||||
defer unpauseAllContainers()
|
if daemonPlatform != "windows" {
|
||||||
testRequires(c, DaemonIsLinux)
|
defer unpauseAllContainers()
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
}
|
||||||
|
out, _ := runSleepingContainer(c, "-d")
|
||||||
out = strings.TrimSpace(out)
|
out = strings.TrimSpace(out)
|
||||||
|
|
||||||
inspectOut := inspectField(c, out, "State.Status")
|
inspectOut := inspectField(c, out, "State.Status")
|
||||||
c.Assert(inspectOut, checker.Equals, "running")
|
c.Assert(inspectOut, checker.Equals, "running")
|
||||||
|
|
||||||
dockerCmd(c, "pause", out)
|
// Windows does not support pause/unpause on Windows Server Containers.
|
||||||
inspectOut = inspectField(c, out, "State.Status")
|
// (RS1 does for Hyper-V Containers, but production CI is not setup for that)
|
||||||
c.Assert(inspectOut, checker.Equals, "paused")
|
if daemonPlatform != "windows" {
|
||||||
|
dockerCmd(c, "pause", out)
|
||||||
|
inspectOut = inspectField(c, out, "State.Status")
|
||||||
|
c.Assert(inspectOut, checker.Equals, "paused")
|
||||||
|
|
||||||
dockerCmd(c, "unpause", out)
|
dockerCmd(c, "unpause", out)
|
||||||
inspectOut = inspectField(c, out, "State.Status")
|
inspectOut = inspectField(c, out, "State.Status")
|
||||||
c.Assert(inspectOut, checker.Equals, "running")
|
c.Assert(inspectOut, checker.Equals, "running")
|
||||||
|
}
|
||||||
|
|
||||||
dockerCmd(c, "stop", out)
|
dockerCmd(c, "stop", out)
|
||||||
inspectOut = inspectField(c, out, "State.Status")
|
inspectOut = inspectField(c, out, "State.Status")
|
||||||
|
@ -79,11 +81,9 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
|
func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
//Both the container and image are named busybox. docker inspect will fetch container
|
//Both the container and image are named busybox. docker inspect will fetch container
|
||||||
//JSON State.Running field. If the field is true, it's a container.
|
//JSON State.Running field. If the field is true, it's a container.
|
||||||
|
runSleepingContainer(c, "--name=busybox", "-d")
|
||||||
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
|
|
||||||
|
|
||||||
formatStr := "--format={{.State.Running}}"
|
formatStr := "--format={{.State.Running}}"
|
||||||
out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox")
|
out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox")
|
||||||
|
@ -91,7 +91,6 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
|
func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
//Run this test on an image named busybox. docker inspect will try to fetch container
|
//Run this test on an image named busybox. docker inspect will try to fetch container
|
||||||
//JSON. Since there is no container named busybox and --type=container, docker inspect will
|
//JSON. Since there is no container named busybox and --type=container, docker inspect will
|
||||||
//not try to get the image JSON. It will throw an error.
|
//not try to get the image JSON. It will throw an error.
|
||||||
|
@ -104,7 +103,6 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
|
func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
//Both the container and image are named busybox. docker inspect will fetch image
|
//Both the container and image are named busybox. docker inspect will fetch image
|
||||||
//JSON as --type=image. if there is no image with name busybox, docker inspect
|
//JSON as --type=image. if there is no image with name busybox, docker inspect
|
||||||
//will throw an error.
|
//will throw an error.
|
||||||
|
@ -116,7 +114,6 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
|
func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
//Both the container and image are named busybox. docker inspect will fail
|
//Both the container and image are named busybox. docker inspect will fail
|
||||||
//as --type=foobar is not a valid value for the flag.
|
//as --type=foobar is not a valid value for the flag.
|
||||||
|
|
||||||
|
@ -145,7 +142,6 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
|
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
|
runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
|
||||||
runCmd.Stdin = strings.NewReader("blahblah")
|
runCmd.Stdin = strings.NewReader("blahblah")
|
||||||
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||||
|
@ -270,7 +266,6 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
|
||||||
|
|
||||||
// #14947
|
// #14947
|
||||||
func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
|
func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||||
id := strings.TrimSpace(out)
|
id := strings.TrimSpace(out)
|
||||||
startedAt := inspectField(c, id, "State.StartedAt")
|
startedAt := inspectField(c, id, "State.StartedAt")
|
||||||
|
@ -292,7 +287,6 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
|
||||||
|
|
||||||
// #15633
|
// #15633
|
||||||
func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
|
func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
|
dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
|
||||||
var logConfig container.LogConfig
|
var logConfig container.LogConfig
|
||||||
|
|
||||||
|
@ -373,11 +367,9 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectHistory(c *check.C) {
|
func (s *DockerSuite) TestInspectHistory(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello")
|
||||||
dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top")
|
|
||||||
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
|
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
|
||||||
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
|
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
|
||||||
|
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
c.Assert(out, checker.Contains, "test comment")
|
c.Assert(out, checker.Contains, "test comment")
|
||||||
}
|
}
|
||||||
|
@ -406,7 +398,6 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestInspectRootFS(c *check.C) {
|
func (s *DockerSuite) TestInspectRootFS(c *check.C) {
|
||||||
testRequires(c, DaemonIsLinux)
|
|
||||||
out, _, err := dockerCmdWithError("inspect", "busybox")
|
out, _, err := dockerCmdWithError("inspect", "busybox")
|
||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue