@@ -14,13 +14,13 @@ import (
1414 "strconv"
1515 "testing"
1616
17+ "github.com/moby/buildkit/client/llb"
18+ gwclient "github.com/moby/buildkit/frontend/gateway/client"
19+ ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
1720 "github.com/project-dalec/dalec"
1821 "github.com/project-dalec/dalec/test/cmd/git_repo/passwd"
1922 gitservices "github.com/project-dalec/dalec/test/git_services"
2023 "github.com/project-dalec/dalec/test/testenv"
21- "github.com/moby/buildkit/client/llb"
22- gwclient "github.com/moby/buildkit/frontend/gateway/client"
23- ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
2424 "golang.org/x/crypto/ssh"
2525 "golang.org/x/crypto/ssh/agent"
2626)
@@ -109,7 +109,8 @@ go {{ .ModFileGoVersion }}
109109
110110 t .Run ("HTTP" , func (t * testing.T ) {
111111 t .Parallel ()
112- netHostBuildxEnv .RunTestOptsFirst (ctx , t , []testenv.TestRunnerOpt {
112+
113+ opts := []testenv.TestRunnerOpt {
113114 // This gives buildkit access to a secret with the name
114115 // `secretName` and the value `passwd.Password`. On the worker that
115116 // fetches the gomod dependencies, a file will be mounted at the
@@ -120,7 +121,9 @@ go {{ .ModFileGoVersion }}
120121 // requests. It is necessary but not sufficient for the buildx
121122 // instance to have host networking enabled.
122123 testenv .WithHostNetworking ,
123- }, func (ctx context.Context , client gwclient.Client ) {
124+ }
125+
126+ netHostBuildxEnv .RunTest (ctx , t , func (ctx context.Context , client gwclient.Client ) {
124127 // This MUST be called at the start of each test. Because we
125128 // persist the go mod cache between runs, the git tag of the
126129 // private go module needs to be unique. Within a single run of the
@@ -167,7 +170,7 @@ go {{ .ModFileGoVersion }}
167170
168171 filename := calculateFilename (ctx , t , attr , res )
169172 checkFile (ctx , t , filename , res , []byte ("bar\n " ))
170- })
173+ }, opts ... )
171174 })
172175
173176 t .Run ("SSH" , func (t * testing.T ) {
@@ -182,12 +185,13 @@ go {{ .ModFileGoVersion }}
182185 pubkey , privkey := generateKeyPair (t )
183186 agentErrChan := startSSHAgent (t , privkey , sockaddr )
184187
185- netHostBuildxEnv . RunTestOptsFirst ( ctx , t , []testenv.TestRunnerOpt {
188+ opts := []testenv.TestRunnerOpt {
186189 // This tells buildkit to forward the SSH Agent socket, giving the
187190 // gomod generator worker access to the private key
188191 testenv .WithSSHSocket (sshID , sockaddr ),
189192 testenv .WithHostNetworking ,
190- }, func (ctx context.Context , client gwclient.Client ) {
193+ }
194+ netHostBuildxEnv .RunTest (ctx , t , func (ctx context.Context , client gwclient.Client ) {
191195 // This MUST be called at the start of each test. Because we
192196 // persist the go mod cache between runs, the git tag of the
193197 // private go module needs to be unique. Within a single run of the
@@ -245,7 +249,7 @@ go {{ .ModFileGoVersion }}
245249
246250 filename := calculateFilename (ctx , t , attr , res )
247251 checkFile (ctx , t , filename , res , []byte ("bar\n " ))
248- })
252+ }, opts ... )
249253 })
250254}
251255
0 commit comments