mirror of
https://github.com/moby/buildkit.git
synced 2026-08-04 14:50:21 +00:00
solver: ensure each ref in the result map is evaluated
There was a typo in d709afdb96.
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@@ -112,6 +112,7 @@ var allTests = integration.TestFuncs(
|
||||
testCacheMultiPlatformImportExport,
|
||||
testOnBuildCleared,
|
||||
testFrontendUseForwardedSolveResults,
|
||||
testFrontendEvaluate,
|
||||
testFrontendInputs,
|
||||
testErrorsSourceMap,
|
||||
testMultiArgs,
|
||||
@@ -4902,6 +4903,47 @@ COPY foo foo2
|
||||
require.Equal(t, dt, []byte("data"))
|
||||
}
|
||||
|
||||
func testFrontendEvaluate(t *testing.T, sb integration.Sandbox) {
|
||||
integration.SkipOnPlatform(t, "windows")
|
||||
c, err := client.New(sb.Context(), sb.Address())
|
||||
require.NoError(t, err)
|
||||
defer c.Close()
|
||||
|
||||
dockerfile := []byte(`
|
||||
FROM scratch
|
||||
COPY badfile /
|
||||
`)
|
||||
dir := integration.Tmpdir(t, fstest.CreateFile("Dockerfile", dockerfile, 0600))
|
||||
|
||||
frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) {
|
||||
_, err := c.Solve(ctx, gateway.SolveRequest{
|
||||
Frontend: "dockerfile.v0",
|
||||
Evaluate: true,
|
||||
})
|
||||
require.ErrorContains(t, err, `"/badfile": not found`)
|
||||
|
||||
_, err = c.Solve(ctx, gateway.SolveRequest{
|
||||
Frontend: "dockerfile.v0",
|
||||
FrontendOpt: map[string]string{
|
||||
"platform": "linux/amd64,linux/arm64",
|
||||
},
|
||||
Evaluate: true,
|
||||
})
|
||||
require.ErrorContains(t, err, `"/badfile": not found`)
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
_, err = c.Build(sb.Context(), client.SolveOpt{
|
||||
Exports: []client.ExportEntry{},
|
||||
LocalDirs: map[string]string{
|
||||
dockerui.DefaultLocalNameDockerfile: dir,
|
||||
dockerui.DefaultLocalNameContext: dir,
|
||||
},
|
||||
}, "", frontend, nil)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func testFrontendInputs(t *testing.T, sb integration.Sandbox) {
|
||||
integration.SkipOnPlatform(t, "windows")
|
||||
f := getFrontend(t, sb)
|
||||
|
||||
@@ -180,7 +180,7 @@ func (b *provenanceBridge) Solve(ctx context.Context, req frontend.SolveRequest,
|
||||
}
|
||||
if req.Evaluate {
|
||||
err = res.EachRef(func(ref solver.ResultProxy) error {
|
||||
_, err := res.Ref.Result(ctx)
|
||||
_, err := ref.Result(ctx)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user