@@ -160,6 +160,7 @@ var allTests = integration.TestFuncs(
160160 testNilProvenance ,
161161 testSBOMScannerArgs ,
162162 testMultiPlatformWarnings ,
163+ testNilContextInSolveGateway ,
163164)
164165
165166// Tests that depend on the `security.*` entitlements
@@ -6600,6 +6601,29 @@ COPY --from=0 / /
66006601 require .Equal (t , expectedDigest , outDigest )
66016602}
66026603
6604+ func testNilContextInSolveGateway (t * testing.T , sb integration.Sandbox ) {
6605+ f := getFrontend (t , sb )
6606+ c , err := client .New (sb .Context (), sb .Address ())
6607+ require .NoError (t , err )
6608+ defer c .Close ()
6609+
6610+ _ , err = c .Build (sb .Context (), client.SolveOpt {}, "" , func (ctx context.Context , c gateway.Client ) (* gateway.Result , error ) {
6611+ res , err := f .SolveGateway (ctx , c , gateway.SolveRequest {
6612+ Frontend : "dockerfile.v0" ,
6613+ FrontendInputs : map [string ]* pb.Definition {
6614+ builder .DefaultLocalNameDockerfile : nil ,
6615+ builder .DefaultLocalNameContext : nil ,
6616+ },
6617+ })
6618+ if err != nil {
6619+ return nil , err
6620+ }
6621+ return res , nil
6622+ }, nil )
6623+ // should not cause buildkitd to panic
6624+ require .ErrorContains (t , err , "invalid nil input definition to definition op" )
6625+ }
6626+
66036627func runShell (dir string , cmds ... string ) error {
66046628 for _ , args := range cmds {
66056629 var cmd * exec.Cmd
0 commit comments