@@ -129,6 +129,14 @@ func (*fakeClient) Ping(context.Context, client.PingOptions) (client.PingResult,
129129 return client.PingResult {OSType : "linux" }, nil
130130}
131131
132+ type fakeWindowsClient struct {
133+ client.Client
134+ }
135+
136+ func (* fakeWindowsClient ) Ping (context.Context , client.PingOptions ) (client.PingResult , error ) {
137+ return client.PingResult {OSType : "windows" }, nil
138+ }
139+
132140func TestIsWindowsBuilderDefault (t * testing.T ) {
133141 tests := []struct {
134142 name string
@@ -209,6 +217,42 @@ func TestBuildkitDisabled(t *testing.T) {
209217 })
210218}
211219
220+ func TestBuildkitDisabledWithWindowsDaemonSkipsWarning (t * testing.T ) {
221+ ctx := t .Context ()
222+
223+ t .Setenv ("DOCKER_BUILDKIT" , "0" )
224+
225+ dir := fs .NewDir (t , t .Name (),
226+ fs .WithFile (pluginFilename , `#!/bin/sh exit 1` , fs .WithMode (0o777 )),
227+ )
228+ defer dir .Remove ()
229+
230+ b := bytes .NewBuffer (nil )
231+
232+ dockerCli , err := command .NewDockerCli (
233+ command .WithBaseContext (ctx ),
234+ command .WithAPIClient (& fakeWindowsClient {}),
235+ command .WithInputStream (discard ),
236+ command .WithCombinedStreams (b ),
237+ )
238+ assert .NilError (t , err )
239+ assert .NilError (t , dockerCli .Initialize (flags .NewClientOptions ()))
240+ dockerCli .ConfigFile ().CLIPluginsExtraDirs = []string {dir .Path ()}
241+
242+ tcmd := newDockerCommand (dockerCli )
243+ tcmd .SetArgs ([]string {"build" , "." })
244+
245+ cmd , args , err := tcmd .HandleGlobalFlags ()
246+ assert .NilError (t , err )
247+
248+ var envs []string
249+ args , os .Args , envs , err = processBuilder (dockerCli , cmd , args , os .Args )
250+ assert .NilError (t , err )
251+ assert .DeepEqual (t , []string {"build" , "." }, args )
252+ assert .Check (t , len (envs ) == 0 )
253+ assert .Equal (t , b .String (), "" )
254+ }
255+
212256func TestBuilderBroken (t * testing.T ) {
213257 ctx := t .Context ()
214258
0 commit comments