@@ -24,6 +24,7 @@ import (
2424 "github.com/moby/buildkit/solver/pb"
2525 "github.com/moby/buildkit/util/entitlements"
2626 "github.com/moby/buildkit/util/grpcerrors"
27+ "github.com/moby/buildkit/util/iohelper"
2728 utilsystem "github.com/moby/buildkit/util/system"
2829 "github.com/moby/buildkit/util/testutil/echoserver"
2930 "github.com/moby/buildkit/util/testutil/integration"
@@ -488,7 +489,7 @@ func testClientGatewayContainerExecPipe(t *testing.T, sb integration.Sandbox) {
488489
489490 pid4 , err := ctr .Start (ctx , client.StartRequest {
490491 Args : []string {"cat" , "/tmp/test" },
491- Stdout : & nopCloser { output },
492+ Stdout : & iohelper. NopWriteCloser { Writer : output },
492493 })
493494 if err != nil {
494495 return nil , err
@@ -836,7 +837,7 @@ func testClientGatewayContainerMounts(t *testing.T, sb integration.Sandbox) {
836837 secretOutput := bytes .NewBuffer (nil )
837838 pid , err = ctr .Start (ctx , client.StartRequest {
838839 Args : []string {"cat" , "/run/secrets/mysecret" },
839- Stdout : & nopCloser { secretOutput },
840+ Stdout : & iohelper. NopWriteCloser { Writer : secretOutput },
840841 })
841842 require .NoError (t , err )
842843 err = pid .Wait ()
@@ -987,8 +988,8 @@ func testClientGatewayContainerPID1Tty(t *testing.T, sb integration.Sandbox) {
987988 Args : []string {"sh" },
988989 Tty : true ,
989990 Stdin : inputR ,
990- Stdout : & nopCloser { output },
991- Stderr : & nopCloser { output },
991+ Stdout : & iohelper. NopWriteCloser { Writer : output },
992+ Stderr : & iohelper. NopWriteCloser { Writer : output },
992993 Env : []string {fmt .Sprintf ("PS1=%s" , prompt .String ())},
993994 })
994995 require .NoError (t , err )
@@ -1069,8 +1070,8 @@ func testClientGatewayContainerCancelPID1Tty(t *testing.T, sb integration.Sandbo
10691070 Args : []string {"sh" },
10701071 Tty : true ,
10711072 Stdin : inputR ,
1072- Stdout : & nopCloser { output },
1073- Stderr : & nopCloser { output },
1073+ Stdout : & iohelper. NopWriteCloser { Writer : output },
1074+ Stderr : & iohelper. NopWriteCloser { Writer : output },
10741075 Env : []string {fmt .Sprintf ("PS1=%s" , prompt .String ())},
10751076 })
10761077 require .NoError (t , err )
@@ -1201,8 +1202,8 @@ func testClientGatewayContainerExecTty(t *testing.T, sb integration.Sandbox) {
12011202 Args : []string {"sh" },
12021203 Tty : true ,
12031204 Stdin : inputR ,
1204- Stdout : & nopCloser { output },
1205- Stderr : & nopCloser { output },
1205+ Stdout : & iohelper. NopWriteCloser { Writer : output },
1206+ Stderr : & iohelper. NopWriteCloser { Writer : output },
12061207 Env : []string {fmt .Sprintf ("PS1=%s" , prompt .String ())},
12071208 })
12081209 require .NoError (t , err )
@@ -1296,8 +1297,8 @@ func testClientGatewayContainerCancelExecTty(t *testing.T, sb integration.Sandbo
12961297 Args : []string {"sh" },
12971298 Tty : true ,
12981299 Stdin : inputR ,
1299- Stdout : & nopCloser { output },
1300- Stderr : & nopCloser { output },
1300+ Stdout : & iohelper. NopWriteCloser { Writer : output },
1301+ Stderr : & iohelper. NopWriteCloser { Writer : output },
13011302 Env : []string {fmt .Sprintf ("PS1=%s" , prompt .String ())},
13021303 })
13031304 require .NoError (t , err )
@@ -1439,7 +1440,7 @@ func testClientGatewayContainerPlatformPATH(t *testing.T, sb integration.Sandbox
14391440 output := bytes .NewBuffer (nil )
14401441 pid1 , err := ctr .Start (ctx , client.StartRequest {
14411442 Args : []string {"/bin/sh" , "-c" , "echo -n $PATH" },
1442- Stdout : & nopCloser { output },
1443+ Stdout : & iohelper. NopWriteCloser { Writer : output },
14431444 })
14441445 require .NoError (t , err )
14451446
@@ -1580,8 +1581,8 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
15801581 Args : []string {"sh" },
15811582 Tty : true ,
15821583 Stdin : inputR ,
1583- Stdout : & nopCloser { pid1Output },
1584- Stderr : & nopCloser { pid1Output },
1584+ Stdout : & iohelper. NopWriteCloser { Writer : pid1Output },
1585+ Stderr : & iohelper. NopWriteCloser { Writer : pid1Output },
15851586 Env : []string {fmt .Sprintf ("PS1=%s" , prompt .String ())},
15861587 })
15871588 require .NoError (t , err )
@@ -1594,7 +1595,7 @@ func testClientGatewayExecError(t *testing.T, sb integration.Sandbox) {
15941595 Env : meta .Env ,
15951596 User : meta .User ,
15961597 Cwd : meta .Cwd ,
1597- Stdout : & nopCloser { output },
1598+ Stdout : & iohelper. NopWriteCloser { Writer : output },
15981599 SecurityMode : exec .Security ,
15991600 })
16001601 require .NoError (t , err )
@@ -1693,7 +1694,7 @@ func testClientGatewaySlowCacheExecError(t *testing.T, sb integration.Sandbox) {
16931694 output := bytes .NewBuffer (nil )
16941695 proc , err := ctr .Start (ctx , client.StartRequest {
16951696 Args : []string {"cat" , "/problem/found/data" },
1696- Stdout : & nopCloser { output },
1697+ Stdout : & iohelper. NopWriteCloser { Writer : output },
16971698 })
16981699 require .NoError (t , err )
16991700
@@ -1843,7 +1844,7 @@ func testClientGatewayExecFileActionError(t *testing.T, sb integration.Sandbox)
18431844 output := bytes .NewBuffer (nil )
18441845 proc , err := ctr .Start (ctx , client.StartRequest {
18451846 Args : []string {"cat" , tt .Path },
1846- Stdout : & nopCloser { output },
1847+ Stdout : & iohelper. NopWriteCloser { Writer : output },
18471848 })
18481849 require .NoError (t , err )
18491850
@@ -1957,8 +1958,8 @@ func testClientGatewayContainerSecurityMode(t *testing.T, sb integration.Sandbox
19571958
19581959 pid , err := ctr .Start (ctx , client.StartRequest {
19591960 Args : command ,
1960- Stdout : & nopCloser { stdout },
1961- Stderr : & nopCloser { stderr },
1961+ Stdout : & iohelper. NopWriteCloser { Writer : stdout },
1962+ Stderr : & iohelper. NopWriteCloser { Writer : stderr },
19621963 SecurityMode : mode ,
19631964 })
19641965 if err != nil {
@@ -2048,8 +2049,8 @@ func testClientGatewayContainerExtraHosts(t *testing.T, sb integration.Sandbox)
20482049
20492050 pid , err := ctr .Start (ctx , client.StartRequest {
20502051 Args : []string {"grep" , "169.254.11.22\t some.host" , "/etc/hosts" },
2051- Stdout : & nopCloser { stdout },
2052- Stderr : & nopCloser { stderr },
2052+ Stdout : & iohelper. NopWriteCloser { Writer : stdout },
2053+ Stderr : & iohelper. NopWriteCloser { Writer : stderr },
20532054 })
20542055 if err != nil {
20552056 ctr .Release (ctx )
@@ -2147,8 +2148,8 @@ func testClientGatewayContainerHostNetworking(t *testing.T, sb integration.Sandb
21472148
21482149 pid , err := ctr .Start (ctx , client.StartRequest {
21492150 Args : []string {"/bin/sh" , "-c" , fmt .Sprintf ("nc 127.0.0.1 %s | grep foo" , port )},
2150- Stdout : & nopCloser { stdout },
2151- Stderr : & nopCloser { stderr },
2151+ Stdout : & iohelper. NopWriteCloser { Writer : stdout },
2152+ Stderr : & iohelper. NopWriteCloser { Writer : stderr },
21522153 })
21532154 if err != nil {
21542155 ctr .Release (ctx )
@@ -2364,11 +2365,3 @@ func testClientGatewayEmptyImageExec(t *testing.T, sb integration.Sandbox) {
23642365 }, nil )
23652366 require .NoError (t , err )
23662367}
2367-
2368- type nopCloser struct {
2369- io.Writer
2370- }
2371-
2372- func (n * nopCloser ) Close () error {
2373- return nil
2374- }
0 commit comments