@@ -23,6 +23,9 @@ import (
2323var pluginFilename = "docker-buildx"
2424
2525func TestBuildWithBuilder (t * testing.T ) {
26+ ctx , cancel := context .WithCancel (context .TODO ())
27+ defer cancel ()
28+
2629 testcases := []struct {
2730 name string
2831 context string
@@ -64,12 +67,16 @@ echo '{"SchemaVersion":"0.1.0","Vendor":"Docker Inc.","Version":"v0.6.3","ShortD
6467 for _ , tt := range testcases {
6568 tt := tt
6669 t .Run (tt .name , func (t * testing.T ) {
70+ ctx2 , cancel2 := context .WithCancel (ctx )
71+ defer cancel2 ()
72+
6773 if tt .builder != "" {
6874 t .Setenv ("BUILDX_BUILDER" , tt .builder )
6975 }
7076
7177 var b bytes.Buffer
7278 dockerCli , err := command .NewDockerCli (
79+ command .WithBaseContext (ctx2 ),
7380 command .WithAPIClient (& fakeClient {}),
7481 command .WithInputStream (discard ),
7582 command .WithCombinedStreams (& b ),
@@ -126,6 +133,9 @@ func (c *fakeClient) Ping(_ context.Context) (types.Ping, error) {
126133}
127134
128135func TestBuildkitDisabled (t * testing.T ) {
136+ ctx , cancel := context .WithCancel (context .TODO ())
137+ defer cancel ()
138+
129139 t .Setenv ("DOCKER_BUILDKIT" , "0" )
130140
131141 dir := fs .NewDir (t , t .Name (),
@@ -136,6 +146,7 @@ func TestBuildkitDisabled(t *testing.T) {
136146 b := bytes .NewBuffer (nil )
137147
138148 dockerCli , err := command .NewDockerCli (
149+ command .WithBaseContext (ctx ),
139150 command .WithAPIClient (& fakeClient {}),
140151 command .WithInputStream (discard ),
141152 command .WithCombinedStreams (b ),
@@ -163,6 +174,9 @@ func TestBuildkitDisabled(t *testing.T) {
163174}
164175
165176func TestBuilderBroken (t * testing.T ) {
177+ ctx , cancel := context .WithCancel (context .TODO ())
178+ defer cancel ()
179+
166180 dir := fs .NewDir (t , t .Name (),
167181 fs .WithFile (pluginFilename , `#!/bin/sh exit 1` , fs .WithMode (0o777 )),
168182 )
@@ -171,6 +185,7 @@ func TestBuilderBroken(t *testing.T) {
171185 b := bytes .NewBuffer (nil )
172186
173187 dockerCli , err := command .NewDockerCli (
188+ command .WithBaseContext (ctx ),
174189 command .WithAPIClient (& fakeClient {}),
175190 command .WithInputStream (discard ),
176191 command .WithCombinedStreams (b ),
@@ -199,6 +214,8 @@ func TestBuilderBroken(t *testing.T) {
199214
200215func TestBuilderBrokenEnforced (t * testing.T ) {
201216 t .Setenv ("DOCKER_BUILDKIT" , "1" )
217+ ctx , cancel := context .WithCancel (context .TODO ())
218+ defer cancel ()
202219
203220 dir := fs .NewDir (t , t .Name (),
204221 fs .WithFile (pluginFilename , `#!/bin/sh exit 1` , fs .WithMode (0o777 )),
@@ -208,6 +225,7 @@ func TestBuilderBrokenEnforced(t *testing.T) {
208225 b := bytes .NewBuffer (nil )
209226
210227 dockerCli , err := command .NewDockerCli (
228+ command .WithBaseContext (ctx ),
211229 command .WithAPIClient (& fakeClient {}),
212230 command .WithInputStream (discard ),
213231 command .WithCombinedStreams (b ),
0 commit comments