Browse Source

Temporarily disable broken E2E tests on Windows

Signed-off-by: Laura Brehm <[email protected]>
Laura Brehm 3 years ago
parent
commit
8714f983ac
3 changed files with 57 additions and 39 deletions
  1. 52 38
      pkg/e2e/build_test.go
  2. 1 1
      pkg/e2e/compose_test.go
  3. 4 0
      pkg/e2e/volumes_test.go

+ 52 - 38
pkg/e2e/build_test.go

@@ -18,6 +18,7 @@ package e2e
 
 import (
 	"net/http"
+	"runtime"
 	"strings"
 	"testing"
 	"time"
@@ -85,6 +86,51 @@ func TestLocalComposeBuild(t *testing.T) {
 		res.Assert(t, icmd.Expected{Out: `"RESULT": "SUCCESS"`})
 	})
 
+	t.Run("build as part of up", func(t *testing.T) {
+		c.RunDockerOrExitError(t, "rmi", "build-test-nginx")
+		c.RunDockerOrExitError(t, "rmi", "custom-nginx")
+
+		res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "up", "-d")
+		t.Cleanup(func() {
+			c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "down")
+		})
+
+		res.Assert(t, icmd.Expected{Out: "COPY static /usr/share/nginx/html"})
+		res.Assert(t, icmd.Expected{Out: "COPY static2 /usr/share/nginx/html"})
+
+		output := HTTPGetWithRetry(t, "http://localhost:8070", http.StatusOK, 2*time.Second, 20*time.Second)
+		assert.Assert(t, strings.Contains(output, "Hello from Nginx container"))
+
+		c.RunDockerCmd(t, "image", "inspect", "build-test-nginx")
+		c.RunDockerCmd(t, "image", "inspect", "custom-nginx")
+	})
+
+	t.Run("no rebuild when up again", func(t *testing.T) {
+		res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "up", "-d")
+
+		assert.Assert(t, !strings.Contains(res.Stdout(), "COPY static"), res.Stdout())
+	})
+
+	t.Run("rebuild when up --build", func(t *testing.T) {
+		res := c.RunDockerComposeCmd(t, "--workdir", "fixtures/build-test", "up", "-d", "--build")
+
+		res.Assert(t, icmd.Expected{Out: "COPY static /usr/share/nginx/html"})
+		res.Assert(t, icmd.Expected{Out: "COPY static2 /usr/share/nginx/html"})
+	})
+
+	t.Run("cleanup build project", func(t *testing.T) {
+		c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "down")
+		c.RunDockerCmd(t, "rmi", "build-test-nginx")
+		c.RunDockerCmd(t, "rmi", "custom-nginx")
+	})
+}
+
+func TestBuildSSH(t *testing.T) {
+	if runtime.GOOS == "windows" {
+		t.Skip("Running on Windows. Skipping...")
+	}
+	c := NewParallelCLI(t)
+
 	t.Run("build failed with ssh default value", func(t *testing.T) {
 		res := c.RunDockerComposeCmdNoCheck(t, "--project-directory", "fixtures/build-test", "build", "--ssh", "")
 		res.Assert(t, icmd.Expected{
@@ -130,47 +176,12 @@ func TestLocalComposeBuild(t *testing.T) {
 		})
 		c.RunDockerCmd(t, "image", "inspect", "build-test-ssh")
 	})
-
-	t.Run("build as part of up", func(t *testing.T) {
-		c.RunDockerOrExitError(t, "rmi", "build-test-nginx")
-		c.RunDockerOrExitError(t, "rmi", "custom-nginx")
-
-		res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "up", "-d")
-		t.Cleanup(func() {
-			c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "down")
-		})
-
-		res.Assert(t, icmd.Expected{Out: "COPY static /usr/share/nginx/html"})
-		res.Assert(t, icmd.Expected{Out: "COPY static2 /usr/share/nginx/html"})
-
-		output := HTTPGetWithRetry(t, "http://localhost:8070", http.StatusOK, 2*time.Second, 20*time.Second)
-		assert.Assert(t, strings.Contains(output, "Hello from Nginx container"))
-
-		c.RunDockerCmd(t, "image", "inspect", "build-test-nginx")
-		c.RunDockerCmd(t, "image", "inspect", "custom-nginx")
-	})
-
-	t.Run("no rebuild when up again", func(t *testing.T) {
-		res := c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "up", "-d")
-
-		assert.Assert(t, !strings.Contains(res.Stdout(), "COPY static"), res.Stdout())
-	})
-
-	t.Run("rebuild when up --build", func(t *testing.T) {
-		res := c.RunDockerComposeCmd(t, "--workdir", "fixtures/build-test", "up", "-d", "--build")
-
-		res.Assert(t, icmd.Expected{Out: "COPY static /usr/share/nginx/html"})
-		res.Assert(t, icmd.Expected{Out: "COPY static2 /usr/share/nginx/html"})
-	})
-
-	t.Run("cleanup build project", func(t *testing.T) {
-		c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test", "down")
-		c.RunDockerCmd(t, "rmi", "build-test-nginx")
-		c.RunDockerCmd(t, "rmi", "custom-nginx")
-	})
 }
 
 func TestBuildSecrets(t *testing.T) {
+	if runtime.GOOS == "windows" {
+		t.Skip("skipping test on windows")
+	}
 	c := NewParallelCLI(t)
 
 	t.Run("build with secrets", func(t *testing.T) {
@@ -259,6 +270,9 @@ func TestBuildImageDependencies(t *testing.T) {
 }
 
 func TestBuildPlatformsWithCorrectBuildxConfig(t *testing.T) {
+	if runtime.GOOS == "windows" {
+		t.Skip("Running on Windows. Skipping...")
+	}
 	c := NewParallelCLI(t)
 
 	// declare builder

+ 1 - 1
pkg/e2e/compose_test.go

@@ -146,7 +146,7 @@ func TestAttachRestart(t *testing.T) {
 		return strings.Count(res.Stdout(),
 				"failing-1 exited with code 1") == 3, fmt.Sprintf("'failing-1 exited with code 1' not found 3 times in : \n%s\n",
 				debug)
-	}, 2*time.Minute, 2*time.Second)
+	}, 3*time.Minute, 2*time.Second)
 
 	assert.Equal(t, strings.Count(res.Stdout(), "failing-1  | world"), 3, res.Combined())
 }

+ 4 - 0
pkg/e2e/volumes_test.go

@@ -20,6 +20,7 @@ import (
 	"net/http"
 	"os"
 	"path/filepath"
+	"runtime"
 	"strings"
 	"testing"
 	"time"
@@ -99,6 +100,9 @@ func TestProjectVolumeBind(t *testing.T) {
 	const projectName = "compose-e2e-project-volume-bind"
 
 	t.Run("up on project volume with bind specification", func(t *testing.T) {
+		if runtime.GOOS == "windows" {
+			t.Skip("Running on Windows. Skipping...")
+		}
 		tmpDir, err := os.MkdirTemp("", projectName)
 		assert.NilError(t, err)
 		defer os.RemoveAll(tmpDir) //nolint