Browse code

Windows CI: TestCreate* porting

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

John Howard authored on 2016/02/03 09:00:39
Showing 1 changed files
... ...
@@ -20,7 +20,11 @@ import (
20 20
 
21 21
 // Make sure we can create a simple container with some args
22 22
 func (s *DockerSuite) TestCreateArgs(c *check.C) {
23
-	testRequires(c, DaemonIsLinux)
23
+	// TODO Windows. This requires further investigation for porting to
24
+	// Windows CI. Currently fails.
25
+	if daemonPlatform == "windows" {
26
+		c.Skip("Fails on Windows CI")
27
+	}
24 28
 	out, _ := dockerCmd(c, "create", "busybox", "command", "arg1", "arg2", "arg with space")
25 29
 
26 30
 	cleanedContainerID := strings.TrimSpace(out)
... ...
@@ -58,7 +62,6 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
58 58
 
59 59
 // Make sure we can set hostconfig options too
60 60
 func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
61
-	testRequires(c, DaemonIsLinux)
62 61
 	out, _ := dockerCmd(c, "create", "-P", "busybox", "echo")
63 62
 
64 63
 	cleanedContainerID := strings.TrimSpace(out)
... ...
@@ -81,6 +84,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
81 81
 }
82 82
 
83 83
 func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
84
+	// Windows does not currently support port ranges.
84 85
 	testRequires(c, DaemonIsLinux)
85 86
 	out, _ := dockerCmd(c, "create", "-p", "3300-3303:3300-3303/tcp", "busybox", "echo")
86 87
 
... ...
@@ -110,7 +114,8 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
110 110
 
111 111
 }
112 112
 
113
-func (s *DockerSuite) TestCreateWithiLargePortRange(c *check.C) {
113
+func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) {
114
+	// Windows does not currently support port ranges.
114 115
 	testRequires(c, DaemonIsLinux)
115 116
 	out, _ := dockerCmd(c, "create", "-p", "1-65535:1-65535/tcp", "busybox", "echo")
116 117
 
... ...
@@ -141,8 +146,6 @@ func (s *DockerSuite) TestCreateWithiLargePortRange(c *check.C) {
141 141
 
142 142
 // "test123" should be printed by docker create + start
143 143
 func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
144
-	testRequires(c, DaemonIsLinux)
145
-
146 144
 	out, _ := dockerCmd(c, "create", "busybox", "echo", "test123")
147 145
 
148 146
 	cleanedContainerID := strings.TrimSpace(out)
... ...
@@ -153,13 +156,16 @@ func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
153 153
 }
154 154
 
155 155
 func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
156
-	testRequires(c, DaemonIsLinux)
157 156
 	testRequires(c, SameHostDaemon)
157
+	prefix := "/"
158
+	if daemonPlatform == "windows" {
159
+		prefix = `c:\`
160
+	}
158 161
 
159 162
 	name := "test_create_volume"
160
-	dockerCmd(c, "create", "--name", name, "-v", "/foo", "busybox")
163
+	dockerCmd(c, "create", "--name", name, "-v", prefix+"foo", "busybox")
161 164
 
162
-	dir, err := inspectMountSourceField(name, "/foo")
165
+	dir, err := inspectMountSourceField(name, prefix+"foo")
163 166
 	c.Assert(err, check.IsNil, check.Commentf("Error getting volume host path: %q", err))
164 167
 
165 168
 	if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
... ...
@@ -172,7 +178,6 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
172 172
 }
173 173
 
174 174
 func (s *DockerSuite) TestCreateLabels(c *check.C) {
175
-	testRequires(c, DaemonIsLinux)
176 175
 	name := "test_create_labels"
177 176
 	expected := map[string]string{"k1": "v1", "k2": "v2"}
178 177
 	dockerCmd(c, "create", "--name", name, "-l", "k1=v1", "--label", "k2=v2", "busybox")
... ...
@@ -186,7 +191,6 @@ func (s *DockerSuite) TestCreateLabels(c *check.C) {
186 186
 }
187 187
 
188 188
 func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
189
-	testRequires(c, DaemonIsLinux)
190 189
 	imageName := "testcreatebuildlabel"
191 190
 	_, err := buildImage(imageName,
192 191
 		`FROM busybox
... ...
@@ -208,6 +212,10 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
208 208
 }
209 209
 
210 210
 func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
211
+	// TODO Windows. Consider enabling this in TP5 timeframe if Windows support
212
+	// is fully hooked up. The hostname is passed through, but only to the
213
+	// environment variable "COMPUTERNAME". It is not hooked up to hostname.exe
214
+	// or returned in ipconfig. Needs platform support in networking.
211 215
 	testRequires(c, DaemonIsLinux)
212 216
 	out, _ := dockerCmd(c, "run", "-h", "web.0", "busybox", "hostname")
213 217
 	c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))
... ...
@@ -215,7 +223,6 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
215 215
 }
216 216
 
217 217
 func (s *DockerSuite) TestCreateRM(c *check.C) {
218
-	testRequires(c, DaemonIsLinux)
219 218
 	// Test to make sure we can 'rm' a new container that is in
220 219
 	// "Created" state, and has ever been run. Test "rm -f" too.
221 220
 
... ...
@@ -233,6 +240,7 @@ func (s *DockerSuite) TestCreateRM(c *check.C) {
233 233
 }
234 234
 
235 235
 func (s *DockerSuite) TestCreateModeIpcContainer(c *check.C) {
236
+	// Uses Linux specific functionality (--ipc)
236 237
 	testRequires(c, DaemonIsLinux)
237 238
 	testRequires(c, SameHostDaemon, NotUserNamespace)
238 239
 
... ...
@@ -415,9 +423,20 @@ func (s *DockerSuite) TestCreateStopSignal(c *check.C) {
415 415
 }
416 416
 
417 417
 func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) {
418
-	testRequires(c, DaemonIsLinux)
418
+	// TODO Windows. This requires further investigation for porting to
419
+	// Windows CI. Currently fails.
420
+	if daemonPlatform == "windows" {
421
+		c.Skip("Fails on Windows CI")
422
+	}
419 423
 	name := "foo"
420
-	dir := "/home/foo/bar"
424
+	slash := "/"
425
+	prefix := ""
426
+	if daemonPlatform == "windows" {
427
+		prefix = "c:"
428
+		slash = `/`
429
+	}
430
+	dir := prefix + slash + "home" + slash + "foo" + slash + "bar"
431
+
421 432
 	dockerCmd(c, "create", "--name", name, "-w", dir, "busybox")
422
-	dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), "/tmp")
433
+	dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")
423 434
 }