Browse code

Windows: Enable multiple TestInspect tests

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/08/31 07:59:58
Showing 1 changed files
... ...
@@ -36,15 +36,12 @@ func (s *DockerSuite) TestInspectImage(c *check.C) {
36 36
 }
37 37
 
38 38
 func (s *DockerSuite) TestInspectInt64(c *check.C) {
39
-	testRequires(c, DaemonIsLinux)
40
-
41 39
 	dockerCmd(c, "run", "-d", "-m=300M", "--name", "inspectTest", "busybox", "true")
42 40
 	inspectOut := inspectField(c, "inspectTest", "HostConfig.Memory")
43 41
 	c.Assert(inspectOut, checker.Equals, "314572800")
44 42
 }
45 43
 
46 44
 func (s *DockerSuite) TestInspectDefault(c *check.C) {
47
-	testRequires(c, DaemonIsLinux)
48 45
 	//Both the container and image are named busybox. docker inspect will fetch the container JSON.
49 46
 	//If the container JSON is not available, it will go for the image JSON.
50 47
 
... ...
@@ -56,21 +53,26 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
56 56
 }
57 57
 
58 58
 func (s *DockerSuite) TestInspectStatus(c *check.C) {
59
-	defer unpauseAllContainers()
60
-	testRequires(c, DaemonIsLinux)
61
-	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
59
+	if daemonPlatform != "windows" {
60
+		defer unpauseAllContainers()
61
+	}
62
+	out, _ := runSleepingContainer(c, "-d")
62 63
 	out = strings.TrimSpace(out)
63 64
 
64 65
 	inspectOut := inspectField(c, out, "State.Status")
65 66
 	c.Assert(inspectOut, checker.Equals, "running")
66 67
 
67
-	dockerCmd(c, "pause", out)
68
-	inspectOut = inspectField(c, out, "State.Status")
69
-	c.Assert(inspectOut, checker.Equals, "paused")
68
+	// Windows does not support pause/unpause on Windows Server Containers.
69
+	// (RS1 does for Hyper-V Containers, but production CI is not setup for that)
70
+	if daemonPlatform != "windows" {
71
+		dockerCmd(c, "pause", out)
72
+		inspectOut = inspectField(c, out, "State.Status")
73
+		c.Assert(inspectOut, checker.Equals, "paused")
70 74
 
71
-	dockerCmd(c, "unpause", out)
72
-	inspectOut = inspectField(c, out, "State.Status")
73
-	c.Assert(inspectOut, checker.Equals, "running")
75
+		dockerCmd(c, "unpause", out)
76
+		inspectOut = inspectField(c, out, "State.Status")
77
+		c.Assert(inspectOut, checker.Equals, "running")
78
+	}
74 79
 
75 80
 	dockerCmd(c, "stop", out)
76 81
 	inspectOut = inspectField(c, out, "State.Status")
... ...
@@ -79,11 +81,9 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) {
79 79
 }
80 80
 
81 81
 func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
82
-	testRequires(c, DaemonIsLinux)
83 82
 	//Both the container and image are named busybox. docker inspect will fetch container
84 83
 	//JSON State.Running field. If the field is true, it's a container.
85
-
86
-	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
84
+	runSleepingContainer(c, "--name=busybox", "-d")
87 85
 
88 86
 	formatStr := "--format={{.State.Running}}"
89 87
 	out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox")
... ...
@@ -91,7 +91,6 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
91 91
 }
92 92
 
93 93
 func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
94
-	testRequires(c, DaemonIsLinux)
95 94
 	//Run this test on an image named busybox. docker inspect will try to fetch container
96 95
 	//JSON. Since there is no container named busybox and --type=container, docker inspect will
97 96
 	//not try to get the image JSON. It will throw an error.
... ...
@@ -104,7 +103,6 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
104 104
 }
105 105
 
106 106
 func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
107
-	testRequires(c, DaemonIsLinux)
108 107
 	//Both the container and image are named busybox. docker inspect will fetch image
109 108
 	//JSON as --type=image. if there is no image with name busybox, docker inspect
110 109
 	//will throw an error.
... ...
@@ -116,7 +114,6 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
116 116
 }
117 117
 
118 118
 func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
119
-	testRequires(c, DaemonIsLinux)
120 119
 	//Both the container and image are named busybox. docker inspect will fail
121 120
 	//as --type=foobar is not a valid value for the flag.
122 121
 
... ...
@@ -145,7 +142,6 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
145 145
 }
146 146
 
147 147
 func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
148
-	testRequires(c, DaemonIsLinux)
149 148
 	runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
150 149
 	runCmd.Stdin = strings.NewReader("blahblah")
151 150
 	out, _, _, err := runCommandWithStdoutStderr(runCmd)
... ...
@@ -270,7 +266,6 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
270 270
 
271 271
 // #14947
272 272
 func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
273
-	testRequires(c, DaemonIsLinux)
274 273
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
275 274
 	id := strings.TrimSpace(out)
276 275
 	startedAt := inspectField(c, id, "State.StartedAt")
... ...
@@ -292,7 +287,6 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
292 292
 
293 293
 // #15633
294 294
 func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
295
-	testRequires(c, DaemonIsLinux)
296 295
 	dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
297 296
 	var logConfig container.LogConfig
298 297
 
... ...
@@ -373,11 +367,9 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
373 373
 }
374 374
 
375 375
 func (s *DockerSuite) TestInspectHistory(c *check.C) {
376
-	testRequires(c, DaemonIsLinux)
377
-	dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top")
376
+	dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello")
378 377
 	dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
379 378
 	out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
380
-
381 379
 	c.Assert(err, check.IsNil)
382 380
 	c.Assert(out, checker.Contains, "test comment")
383 381
 }
... ...
@@ -406,7 +398,6 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
406 406
 }
407 407
 
408 408
 func (s *DockerSuite) TestInspectRootFS(c *check.C) {
409
-	testRequires(c, DaemonIsLinux)
410 409
 	out, _, err := dockerCmdWithError("inspect", "busybox")
411 410
 	c.Assert(err, check.IsNil)
412 411