Browse code

Windows CI: Deal with failing tests for TP4

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

John Howard authored on 2016/01/09 06:49:43
Showing 10 changed files
... ...
@@ -1311,7 +1311,7 @@ func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
1311 1311
 func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *check.C) {
1312 1312
 	// Requires local volume mount bind.
1313 1313
 	// --read-only + userns has remount issues
1314
-	testRequires(c, SameHostDaemon, NotUserNamespace)
1314
+	testRequires(c, SameHostDaemon, NotUserNamespace, DaemonIsLinux)
1315 1315
 
1316 1316
 	testVol := getTestDir(c, "test-put-container-archive-err-symlink-in-volume-to-read-only-rootfs-")
1317 1317
 	defer os.RemoveAll(testVol)
... ...
@@ -1392,6 +1392,7 @@ func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
1392 1392
 }
1393 1393
 
1394 1394
 func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
1395
+	testRequires(c, DaemonIsLinux)
1395 1396
 	config := map[string]interface{}{
1396 1397
 		"Image":      "busybox",
1397 1398
 		"HostConfig": map[string]interface{}{"ShmSize": -1},
... ...
@@ -1404,6 +1405,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
1404 1404
 }
1405 1405
 
1406 1406
 func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) {
1407
+	testRequires(c, DaemonIsLinux)
1407 1408
 	var defaultSHMSize int64 = 67108864
1408 1409
 	config := map[string]interface{}{
1409 1410
 		"Image": "busybox",
... ...
@@ -1434,6 +1436,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.
1434 1434
 }
1435 1435
 
1436 1436
 func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
1437
+	testRequires(c, DaemonIsLinux)
1437 1438
 	config := map[string]interface{}{
1438 1439
 		"Image":      "busybox",
1439 1440
 		"HostConfig": map[string]interface{}{},
... ...
@@ -1464,6 +1467,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
1464 1464
 }
1465 1465
 
1466 1466
 func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
1467
+	testRequires(c, DaemonIsLinux)
1467 1468
 	config := map[string]interface{}{
1468 1469
 		"Image":      "busybox",
1469 1470
 		"Cmd":        "mount",
... ...
@@ -1494,6 +1498,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
1494 1494
 }
1495 1495
 
1496 1496
 func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *check.C) {
1497
+	testRequires(c, DaemonIsLinux)
1497 1498
 	config := map[string]interface{}{
1498 1499
 		"Image": "busybox",
1499 1500
 	}
... ...
@@ -63,6 +63,7 @@ func (s *DockerSuite) TestExecApiCreateContainerPaused(c *check.C) {
63 63
 }
64 64
 
65 65
 func (s *DockerSuite) TestExecAPIStart(c *check.C) {
66
+	testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvagable to Windows to Windows CI
66 67
 	dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
67 68
 
68 69
 	startExec := func(id string, code int) {
... ...
@@ -47,6 +47,7 @@ func (s *DockerSuite) TestInspectApiContainerResponse(c *check.C) {
47 47
 }
48 48
 
49 49
 func (s *DockerSuite) TestInspectApiContainerVolumeDriverLegacy(c *check.C) {
50
+	testRequires(c, DaemonIsLinux)
50 51
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
51 52
 
52 53
 	cleanedContainerID := strings.TrimSpace(out)
... ...
@@ -111,6 +112,7 @@ func (s *DockerSuite) TestInspectApiImageResponse(c *check.C) {
111 111
 
112 112
 // #17131, #17139, #17173
113 113
 func (s *DockerSuite) TestInspectApiEmptyFieldsInConfigPre121(c *check.C) {
114
+	testRequires(c, DaemonIsLinux)
114 115
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
115 116
 
116 117
 	cleanedContainerID := strings.TrimSpace(out)
... ...
@@ -133,6 +135,7 @@ func (s *DockerSuite) TestInspectApiEmptyFieldsInConfigPre121(c *check.C) {
133 133
 }
134 134
 
135 135
 func (s *DockerSuite) TestInspectApiBridgeNetworkSettings120(c *check.C) {
136
+	testRequires(c, DaemonIsLinux)
136 137
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
137 138
 	containerID := strings.TrimSpace(out)
138 139
 	waitRun(containerID)
... ...
@@ -148,6 +151,7 @@ func (s *DockerSuite) TestInspectApiBridgeNetworkSettings120(c *check.C) {
148 148
 }
149 149
 
150 150
 func (s *DockerSuite) TestInspectApiBridgeNetworkSettings121(c *check.C) {
151
+	testRequires(c, DaemonIsLinux)
151 152
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
152 153
 	containerID := strings.TrimSpace(out)
153 154
 	waitRun(containerID)
... ...
@@ -153,6 +153,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
153 153
 }
154 154
 
155 155
 func (s *DockerSuite) TestAttachPausedContainer(c *check.C) {
156
+	testRequires(c, DaemonIsLinux) // Containers cannot be paused on Windows
156 157
 	defer unpauseAllContainers()
157 158
 	dockerCmd(c, "run", "-d", "--name=test", "busybox", "top")
158 159
 	dockerCmd(c, "pause", "test")
... ...
@@ -561,7 +561,7 @@ func (s *DockerSuite) TestCpToStdout(c *check.C) {
561 561
 }
562 562
 
563 563
 func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
564
-	testRequires(c, SameHostDaemon)
564
+	testRequires(c, SameHostDaemon, DaemonIsLinux)
565 565
 
566 566
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t")
567 567
 
... ...
@@ -43,7 +43,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
43 43
 // TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
44 44
 // `--cluster-store` properly show the backend's endpoint in info output.
45 45
 func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
46
-	testRequires(c, SameHostDaemon)
46
+	testRequires(c, SameHostDaemon, DaemonIsLinux)
47 47
 
48 48
 	d := NewDaemon(c)
49 49
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
... ...
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
61 61
 // TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with
62 62
 // an invalid `--cluster-advertise` configuration
63 63
 func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
64
-	testRequires(c, SameHostDaemon)
64
+	testRequires(c, SameHostDaemon, DaemonIsLinux)
65 65
 
66 66
 	d := NewDaemon(c)
67 67
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
... ...
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
78 78
 // TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
79 79
 // configured with interface name properly show the advertise ip-address in info output.
80 80
 func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
81
-	testRequires(c, SameHostDaemon, Network)
81
+	testRequires(c, SameHostDaemon, Network, DaemonIsLinux)
82 82
 
83 83
 	d := NewDaemon(c)
84 84
 	discoveryBackend := "consul://consuladdr:consulport/some/path"
... ...
@@ -380,6 +380,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
380 380
 }
381 381
 
382 382
 func (s *DockerSuite) TestInspectHistory(c *check.C) {
383
+	testRequires(c, DaemonIsLinux)
383 384
 	dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top")
384 385
 	dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
385 386
 	out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
... ...
@@ -58,3 +58,10 @@ func (s *DockerSuite) TestPauseMultipleContainers(c *check.C) {
58 58
 		c.Assert(actions[len(actions)-1], checker.Equals, "unpause")
59 59
 	}
60 60
 }
61
+
62
+func (s *DockerSuite) TestPauseFailsOnWindows(c *check.C) {
63
+	testRequires(c, DaemonIsWindows)
64
+	dockerCmd(c, "run", "-d", "--name=test", "busybox", "sleep 3")
65
+	out, _, _ := dockerCmdWithError("pause", "test")
66
+	c.Assert(out, checker.Contains, "Windows: Containers cannot be paused")
67
+}
... ...
@@ -3731,14 +3731,20 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) {
3731 3731
 	}
3732 3732
 }
3733 3733
 
3734
-// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126.
3734
+// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126, or
3735
+// 127 on Windows. The difference is that in Windows, the container must be started
3736
+// as that's when the check is made (and yes, by it's design...)
3735 3737
 func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
3738
+	expected := 126
3739
+	if daemonPlatform == "windows" {
3740
+		expected = 127
3741
+	}
3736 3742
 	name := "testCmdCannotBeInvoked"
3737 3743
 	runCmd := exec.Command(dockerBinary, "run", "--name", name, "busybox", "/etc")
3738 3744
 	_, exit, _ := runCommandWithOutput(runCmd)
3739 3745
 	stateExitCode := findContainerExitCode(c, name)
3740
-	if !(exit == 126 && strings.Contains(stateExitCode, "126")) {
3741
-		c.Fatalf("Run cmd that cannot be invoked should have errored with code 126, but we got exit: %d, State.ExitCode: %s", exit, stateExitCode)
3746
+	if !(exit == expected && strings.Contains(stateExitCode, strconv.Itoa(expected))) {
3747
+		c.Fatalf("Run cmd that cannot be invoked should have errored with code %d, but we got exit: %d, State.ExitCode: %s", expected, exit, stateExitCode)
3742 3748
 	}
3743 3749
 }
3744 3750
 
... ...
@@ -89,6 +89,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
89 89
 }
90 90
 
91 91
 func (s *DockerSuite) TestSaveCheckTimes(c *check.C) {
92
+	testRequires(c, DaemonIsLinux)
92 93
 	repoName := "busybox:latest"
93 94
 	out, _ := dockerCmd(c, "inspect", repoName)
94 95
 	data := []struct {