Windows: Enable more create tests
| ... | ... |
@@ -20,12 +20,8 @@ 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 |
- // 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 |
- } |
|
| 28 |
- out, _ := dockerCmd(c, "create", "busybox", "command", "arg1", "arg2", "arg with space", "-c", "flags") |
|
| 23 |
+ // Intentionally clear entrypoint, as the Windows busybox image needs an entrypoint, which breaks this test |
|
| 24 |
+ out, _ := dockerCmd(c, "create", "--entrypoint=", "busybox", "command", "arg1", "arg2", "arg with space", "-c", "flags") |
|
| 29 | 25 |
|
| 30 | 26 |
cleanedContainerID := strings.TrimSpace(out) |
| 31 | 27 |
|
| ... | ... |
@@ -62,7 +58,10 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
|
| 62 | 62 |
|
| 63 | 63 |
// Make sure we can grow the container's rootfs at creation time. |
| 64 | 64 |
func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) {
|
| 65 |
- testRequires(c, Devicemapper) |
|
| 65 |
+ // Windows and Devicemapper support growing the rootfs |
|
| 66 |
+ if daemonPlatform != "windows" {
|
|
| 67 |
+ testRequires(c, Devicemapper) |
|
| 68 |
+ } |
|
| 66 | 69 |
out, _ := dockerCmd(c, "create", "--storage-opt", "size=120G", "busybox") |
| 67 | 70 |
|
| 68 | 71 |
cleanedContainerID := strings.TrimSpace(out) |
| ... | ... |
@@ -174,15 +173,12 @@ func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
|
| 174 | 174 |
|
| 175 | 175 |
func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
|
| 176 | 176 |
testRequires(c, SameHostDaemon) |
| 177 |
- prefix := "/" |
|
| 178 |
- if daemonPlatform == "windows" {
|
|
| 179 |
- prefix = `c:\` |
|
| 180 |
- } |
|
| 177 |
+ prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
|
| 181 | 178 |
|
| 182 | 179 |
name := "test_create_volume" |
| 183 |
- dockerCmd(c, "create", "--name", name, "-v", prefix+"foo", "busybox") |
|
| 180 |
+ dockerCmd(c, "create", "--name", name, "-v", prefix+slash+"foo", "busybox") |
|
| 184 | 181 |
|
| 185 |
- dir, err := inspectMountSourceField(name, prefix+"foo") |
|
| 182 |
+ dir, err := inspectMountSourceField(name, prefix+slash+"foo") |
|
| 186 | 183 |
c.Assert(err, check.IsNil, check.Commentf("Error getting volume host path: %q", err))
|
| 187 | 184 |
|
| 188 | 185 |
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
|
| ... | ... |
@@ -229,12 +225,12 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
|
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 | 231 |
func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
|
| 232 |
- // TODO Windows. Consider enabling this in TP5 timeframe if Windows support |
|
| 233 |
- // is fully hooked up. The hostname is passed through, but only to the |
|
| 234 |
- // environment variable "COMPUTERNAME". It is not hooked up to hostname.exe |
|
| 235 |
- // or returned in ipconfig. Needs platform support in networking. |
|
| 236 |
- testRequires(c, DaemonIsLinux) |
|
| 237 |
- out, _ := dockerCmd(c, "run", "-h", "web.0", "busybox", "hostname") |
|
| 232 |
+ image := "busybox" |
|
| 233 |
+ // Busybox on Windows does not implement hostname command |
|
| 234 |
+ if daemonPlatform == "windows" {
|
|
| 235 |
+ image = WindowsBaseImage |
|
| 236 |
+ } |
|
| 237 |
+ out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname") |
|
| 238 | 238 |
c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))
|
| 239 | 239 |
|
| 240 | 240 |
} |
| ... | ... |
@@ -443,17 +439,16 @@ func (s *DockerSuite) TestCreateStopSignal(c *check.C) {
|
| 443 | 443 |
} |
| 444 | 444 |
|
| 445 | 445 |
func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) {
|
| 446 |
- // TODO Windows. This requires further investigation for porting to |
|
| 447 |
- // Windows CI. Currently fails. |
|
| 448 |
- if daemonPlatform == "windows" {
|
|
| 449 |
- c.Skip("Fails on Windows CI")
|
|
| 450 |
- } |
|
| 451 | 446 |
name := "foo" |
| 452 | 447 |
|
| 453 | 448 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 454 | 449 |
dir := prefix + slash + "home" + slash + "foo" + slash + "bar" |
| 455 | 450 |
|
| 456 | 451 |
dockerCmd(c, "create", "--name", name, "-w", dir, "busybox") |
| 452 |
+ // Windows does not create the workdir until the container is started |
|
| 453 |
+ if daemonPlatform == "windows" {
|
|
| 454 |
+ dockerCmd(c, "start", name) |
|
| 455 |
+ } |
|
| 457 | 456 |
dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")
|
| 458 | 457 |
} |
| 459 | 458 |
|