Browse Source

Merge pull request #10913 from ahmetalpbalkan/win-cli/UnixSpecific-skip

integ-cli: Skip some unix-specific cli tests
Jessie Frazelle 10 years ago
parent
commit
695bf3348f

+ 6 - 0
integration-cli/docker_cli_build_test.go

@@ -1673,6 +1673,8 @@ func TestBuildAddBadLinksVolume(t *testing.T) {
 // Issue #5270 - ensure we throw a better error than "unexpected EOF"
 // Issue #5270 - ensure we throw a better error than "unexpected EOF"
 // when we can't access files in the context.
 // when we can't access files in the context.
 func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
 func TestBuildWithInaccessibleFilesInContext(t *testing.T) {
+	testRequires(t, UnixCli) // test uses chown/chmod: not available on windows
+
 	{
 	{
 		name := "testbuildinaccessiblefiles"
 		name := "testbuildinaccessiblefiles"
 		defer deleteImages(name)
 		defer deleteImages(name)
@@ -4387,6 +4389,8 @@ func TestBuildStderr(t *testing.T) {
 }
 }
 
 
 func TestBuildChownSingleFile(t *testing.T) {
 func TestBuildChownSingleFile(t *testing.T) {
+	testRequires(t, UnixCli) // test uses chown: not available on windows
+
 	name := "testbuildchownsinglefile"
 	name := "testbuildchownsinglefile"
 	defer deleteImages(name)
 	defer deleteImages(name)
 
 
@@ -4658,6 +4662,8 @@ func TestBuildFromOfficialNames(t *testing.T) {
 }
 }
 
 
 func TestBuildDockerfileOutsideContext(t *testing.T) {
 func TestBuildDockerfileOutsideContext(t *testing.T) {
+	testRequires(t, UnixCli) // uses os.Symlink: not implemented in windows at the time of writing (go-1.4.2)
+
 	name := "testbuilddockerfileoutsidecontext"
 	name := "testbuilddockerfileoutsidecontext"
 	tmpdir, err := ioutil.TempDir("", name)
 	tmpdir, err := ioutil.TempDir("", name)
 	if err != nil {
 	if err != nil {

+ 2 - 0
integration-cli/docker_cli_cp_test.go

@@ -347,6 +347,8 @@ func TestCpSymlinkComponent(t *testing.T) {
 
 
 // Check that cp with unprivileged user doesn't return any error
 // Check that cp with unprivileged user doesn't return any error
 func TestCpUnprivilegedUser(t *testing.T) {
 func TestCpUnprivilegedUser(t *testing.T) {
+	testRequires(t, UnixCli) // uses chmod/su: not available on windows
+
 	out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
 	out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
 	if err != nil || exitCode != 0 {
 	if err != nil || exitCode != 0 {
 		t.Fatal("failed to create a container", out, err)
 		t.Fatal("failed to create a container", out, err)

+ 4 - 0
integration-cli/requirements.go

@@ -17,6 +17,10 @@ var (
 		func() bool { return isLocalDaemon },
 		func() bool { return isLocalDaemon },
 		"Test requires docker daemon to runs on the same machine as CLI",
 		"Test requires docker daemon to runs on the same machine as CLI",
 	}
 	}
+	UnixCli = TestRequirement{
+		func() bool { return isUnixCli },
+		"Test requires posix utilities or functionality to run.",
+	}
 )
 )
 
 
 // testRequires checks if the environment satisfies the requirements
 // testRequires checks if the environment satisfies the requirements

+ 8 - 0
integration-cli/test_vars_unix.go

@@ -0,0 +1,8 @@
+// +build !windows
+
+package main
+
+const (
+	// identifies if test suite is running on a unix platform
+	isUnixCli = true
+)

+ 8 - 0
integration-cli/test_vars_windows.go

@@ -0,0 +1,8 @@
+// +build windows
+
+package main
+
+const (
+	// identifies if test suite is running on a unix platform
+	isUnixCli = false
+)