Browse code

integration: run more Buildkit tests on Windows

Buildkit was enabled for Windows engines when using containerd
snapshotters in commit a9ec07a005eebda6c63339fab354e6358319a7ac.
Buildkit's integration tests are run on Windows in CI, but a handful of
daemon integration tests are still skipped. Change those tests to only
skip on Windows when the daemon under test is not using containerd
snapshotters.

Signed-off-by: Cory Snider <csnider@mirantis.com>

Cory Snider authored on 2026/02/04 06:11:30
Showing 7 changed files
... ...
@@ -6213,9 +6213,8 @@ func (s *DockerCLIBuildSuite) TestBuildEmitsEvents(t *testing.T) {
6213 6213
 			},
6214 6214
 		} {
6215 6215
 			t.Run(fmt.Sprintf("buildkit=%v/%s", builder.buildkit, tc.name), func(t *testing.T) {
6216
-				if builder.buildkit {
6217
-					skip.If(t, DaemonIsWindows, "Buildkit is not supported on Windows")
6218
-				}
6216
+				skip.If(t, builder.buildkit && DaemonIsWindows() && !containerdSnapshotterEnabled(),
6217
+					"Buildkit is not supported on Windows with graphdrivers")
6219 6218
 
6220 6219
 				time.Sleep(time.Second)
6221 6220
 				before := time.Now()
... ...
@@ -720,9 +720,8 @@ func TestBuildEmitsImageCreateEvent(t *testing.T) {
720 720
 
721 721
 	for _, builderVersion := range []build.BuilderVersion{build.BuilderV1, build.BuilderBuildKit} {
722 722
 		t.Run("v"+string(builderVersion), func(t *testing.T) {
723
-			if builderVersion == build.BuilderBuildKit {
724
-				skip.If(t, testEnv.DaemonInfo.OSType == "windows", "Buildkit is not supported on Windows")
725
-			}
723
+			skip.If(t, builderVersion == build.BuilderBuildKit && testEnv.DaemonInfo.OSType == "windows" && !testEnv.UsingSnapshotter(),
724
+				"Buildkit is not supported on Windows with graphdrivers")
726 725
 
727 726
 			ctx, cancel := context.WithCancel(ctx)
728 727
 			defer cancel()
... ...
@@ -774,7 +773,6 @@ func TestBuildEmitsImageCreateEvent(t *testing.T) {
774 774
 }
775 775
 
776 776
 func TestBuildHistoryDoesNotPreventRemoval(t *testing.T) {
777
-	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "buildkit is not supported on Windows")
778 777
 	skip.If(t, !testEnv.UsingSnapshotter(), "only relevant to c8d integration")
779 778
 
780 779
 	ctx := setupTest(t)
... ...
@@ -6,6 +6,10 @@ import (
6 6
 	"testing"
7 7
 	"time"
8 8
 
9
+	// Register the npipe: protocol connection helper so the Buildkit client
10
+	// can dial Windows daemons.
11
+	_ "github.com/moby/buildkit/client/connhelper/npipe"
12
+
9 13
 	moby_buildkit_v1 "github.com/moby/buildkit/api/services/control"
10 14
 	"github.com/moby/buildkit/client"
11 15
 	"github.com/moby/buildkit/client/llb"
... ...
@@ -28,7 +32,8 @@ func (t *testWriter) Write(p []byte) (int, error) {
28 28
 }
29 29
 
30 30
 func TestBuildkitHistoryTracePropagation(t *testing.T) {
31
-	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "buildkit is not supported on Windows")
31
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" && !testEnv.UsingSnapshotter(),
32
+		"buildkit is not supported on Windows with graphdrivers")
32 33
 
33 34
 	ctx := testutil.StartSpan(baseContext, t)
34 35
 
35 36
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+// Package npipe provides connhelper for npipe://<address>
1
+package npipe
2
+
3
+import "github.com/moby/buildkit/client/connhelper"
4
+
5
+func init() {
6
+	connhelper.Register("npipe", Helper)
7
+}
0 8
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+//go:build !windows
1
+
2
+package npipe
3
+
4
+import (
5
+	"errors"
6
+	"net/url"
7
+
8
+	"github.com/moby/buildkit/client/connhelper"
9
+)
10
+
11
+func Helper(u *url.URL) (*connhelper.ConnectionHelper, error) {
12
+	return nil, errors.New("npipe connections are only supported on windows")
13
+}
0 14
new file mode 100644
... ...
@@ -0,0 +1,28 @@
0
+//go:build windows
1
+
2
+package npipe
3
+
4
+import (
5
+	"context"
6
+	"net"
7
+	"net/url"
8
+	"strings"
9
+
10
+	"github.com/Microsoft/go-winio"
11
+	"github.com/moby/buildkit/client/connhelper"
12
+	"github.com/pkg/errors"
13
+)
14
+
15
+// Helper returns helper for connecting to a url via npipes.
16
+func Helper(u *url.URL) (*connhelper.ConnectionHelper, error) {
17
+	addrParts := strings.SplitN(u.String(), "://", 2)
18
+	if len(addrParts) != 2 {
19
+		return nil, errors.Errorf("invalid address %s", u)
20
+	}
21
+	address := strings.ReplaceAll(addrParts[1], "/", "\\")
22
+	return &connhelper.ConnectionHelper{
23
+		ContextDialer: func(ctx context.Context, addr string) (net.Conn, error) {
24
+			return winio.DialPipeContext(ctx, address)
25
+		},
26
+	}, nil
27
+}
... ...
@@ -992,6 +992,7 @@ github.com/moby/buildkit/cache/util
992 992
 github.com/moby/buildkit/client
993 993
 github.com/moby/buildkit/client/buildid
994 994
 github.com/moby/buildkit/client/connhelper
995
+github.com/moby/buildkit/client/connhelper/npipe
995 996
 github.com/moby/buildkit/client/llb
996 997
 github.com/moby/buildkit/client/llb/imagemetaresolver
997 998
 github.com/moby/buildkit/client/llb/sourceresolver