Skip to content

Commit

Permalink
Windows CI: Deal with failing tests for TP4
Browse files Browse the repository at this point in the history
Signed-off-by: John Howard <jhoward@microsoft.com>
  • Loading branch information
John Howard committed Jan 8, 2016
1 parent 719526d commit 25c3833
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 8 deletions.
7 changes: 6 additions & 1 deletion integration-cli/docker_api_containers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(c *check.C) {
// Requires local volume mount bind.
// --read-only + userns has remount issues
testRequires(c, SameHostDaemon, NotUserNamespace)
testRequires(c, SameHostDaemon, NotUserNamespace, DaemonIsLinux)

testVol := getTestDir(c, "test-put-container-archive-err-symlink-in-volume-to-read-only-rootfs-")
defer os.RemoveAll(testVol)
Expand Down Expand Up @@ -1392,6 +1392,7 @@ func (s *DockerSuite) TestStartWithNilDNS(c *check.C) {
}

func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
testRequires(c, DaemonIsLinux)
config := map[string]interface{}{
"Image": "busybox",
"HostConfig": map[string]interface{}{"ShmSize": -1},
Expand All @@ -1404,6 +1405,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) {
}

func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) {
testRequires(c, DaemonIsLinux)
var defaultSHMSize int64 = 67108864
config := map[string]interface{}{
"Image": "busybox",
Expand Down Expand Up @@ -1434,6 +1436,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.
}

func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
testRequires(c, DaemonIsLinux)
config := map[string]interface{}{
"Image": "busybox",
"HostConfig": map[string]interface{}{},
Expand Down Expand Up @@ -1464,6 +1467,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *check.C) {
}

func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
testRequires(c, DaemonIsLinux)
config := map[string]interface{}{
"Image": "busybox",
"Cmd": "mount",
Expand Down Expand Up @@ -1494,6 +1498,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *check.C) {
}

func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted(c *check.C) {
testRequires(c, DaemonIsLinux)
config := map[string]interface{}{
"Image": "busybox",
}
Expand Down
1 change: 1 addition & 0 deletions integration-cli/docker_api_exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (s *DockerSuite) TestExecApiCreateContainerPaused(c *check.C) {
}

func (s *DockerSuite) TestExecAPIStart(c *check.C) {
testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvagable to Windows to Windows CI
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")

startExec := func(id string, code int) {
Expand Down
4 changes: 4 additions & 0 deletions integration-cli/docker_api_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (s *DockerSuite) TestInspectApiContainerResponse(c *check.C) {
}

func (s *DockerSuite) TestInspectApiContainerVolumeDriverLegacy(c *check.C) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")

cleanedContainerID := strings.TrimSpace(out)
Expand Down Expand Up @@ -111,6 +112,7 @@ func (s *DockerSuite) TestInspectApiImageResponse(c *check.C) {

// #17131, #17139, #17173
func (s *DockerSuite) TestInspectApiEmptyFieldsInConfigPre121(c *check.C) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")

cleanedContainerID := strings.TrimSpace(out)
Expand All @@ -133,6 +135,7 @@ func (s *DockerSuite) TestInspectApiEmptyFieldsInConfigPre121(c *check.C) {
}

func (s *DockerSuite) TestInspectApiBridgeNetworkSettings120(c *check.C) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
containerID := strings.TrimSpace(out)
waitRun(containerID)
Expand All @@ -148,6 +151,7 @@ func (s *DockerSuite) TestInspectApiBridgeNetworkSettings120(c *check.C) {
}

func (s *DockerSuite) TestInspectApiBridgeNetworkSettings121(c *check.C) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
containerID := strings.TrimSpace(out)
waitRun(containerID)
Expand Down
1 change: 1 addition & 0 deletions integration-cli/docker_cli_attach_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
}

func (s *DockerSuite) TestAttachPausedContainer(c *check.C) {
testRequires(c, DaemonIsLinux) // Containers cannot be paused on Windows
defer unpauseAllContainers()
dockerCmd(c, "run", "-d", "--name=test", "busybox", "top")
dockerCmd(c, "pause", "test")
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_cp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ func (s *DockerSuite) TestCpToStdout(c *check.C) {
}

func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
testRequires(c, SameHostDaemon)
testRequires(c, SameHostDaemon, DaemonIsLinux)

out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t")

Expand Down
6 changes: 3 additions & 3 deletions integration-cli/docker_cli_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
// TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
// `--cluster-store` properly show the backend's endpoint in info output.
func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
testRequires(c, SameHostDaemon)
testRequires(c, SameHostDaemon, DaemonIsLinux)

d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path"
Expand All @@ -61,7 +61,7 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with
// an invalid `--cluster-advertise` configuration
func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
testRequires(c, SameHostDaemon)
testRequires(c, SameHostDaemon, DaemonIsLinux)

d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path"
Expand All @@ -78,7 +78,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
// configured with interface name properly show the advertise ip-address in info output.
func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
testRequires(c, SameHostDaemon, Network)
testRequires(c, SameHostDaemon, Network, DaemonIsLinux)

d := NewDaemon(c)
discoveryBackend := "consul://consuladdr:consulport/some/path"
Expand Down
1 change: 1 addition & 0 deletions integration-cli/docker_cli_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *check.C) {
}

func (s *DockerSuite) TestInspectHistory(c *check.C) {
testRequires(c, DaemonIsLinux)
dockerCmd(c, "run", "--name=testcont", "-d", "busybox", "top")
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
Expand Down
7 changes: 7 additions & 0 deletions integration-cli/docker_cli_pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ func (s *DockerSuite) TestPauseMultipleContainers(c *check.C) {
c.Assert(actions[len(actions)-1], checker.Equals, "unpause")
}
}

func (s *DockerSuite) TestPauseFailsOnWindows(c *check.C) {
testRequires(c, DaemonIsWindows)
dockerCmd(c, "run", "-d", "--name=test", "busybox", "sleep 3")
out, _, _ := dockerCmdWithError("pause", "test")
c.Assert(out, checker.Contains, "Windows: Containers cannot be paused")
}
12 changes: 9 additions & 3 deletions integration-cli/docker_cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3731,14 +3731,20 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) {
}
}

// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126.
// TestCmdCannotBeInvoked checks that 'docker run busybox /etc' exits with 126, or
// 127 on Windows. The difference is that in Windows, the container must be started
// as that's when the check is made (and yes, by it's design...)
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
expected := 126
if daemonPlatform == "windows" {
expected = 127
}
name := "testCmdCannotBeInvoked"
runCmd := exec.Command(dockerBinary, "run", "--name", name, "busybox", "/etc")
_, exit, _ := runCommandWithOutput(runCmd)
stateExitCode := findContainerExitCode(c, name)
if !(exit == 126 && strings.Contains(stateExitCode, "126")) {
c.Fatalf("Run cmd that cannot be invoked should have errored with code 126, but we got exit: %d, State.ExitCode: %s", exit, stateExitCode)
if !(exit == expected && strings.Contains(stateExitCode, strconv.Itoa(expected))) {
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)
}
}

Expand Down
1 change: 1 addition & 0 deletions integration-cli/docker_cli_save_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
}

func (s *DockerSuite) TestSaveCheckTimes(c *check.C) {
testRequires(c, DaemonIsLinux)
repoName := "busybox:latest"
out, _ := dockerCmd(c, "inspect", repoName)
data := []struct {
Expand Down

0 comments on commit 25c3833

Please sign in to comment.