Skip to content

Commit

Permalink
Add regression test for run cache not considering mounts
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Lehmann <[email protected]>
  • Loading branch information
aaronlehmann committed Apr 14, 2021
1 parent 0e106e6 commit 6ab9eea
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func TestIntegration(t *testing.T) {
testSharedCacheMounts,
testLockedCacheMounts,
testDuplicateCacheMount,
testRunCacheWithMounts,
testParallelLocalBuilds,
testSecretMounts,
testExtraHosts,
Expand Down Expand Up @@ -2771,6 +2772,33 @@ func testDuplicateCacheMount(t *testing.T, sb integration.Sandbox) {
require.NoError(t, err)
}

func testRunCacheWithMounts(t *testing.T, sb integration.Sandbox) {
requiresLinux(t)
c, err := New(context.TODO(), sb.Address())
require.NoError(t, err)
defer c.Close()

busybox := llb.Image("busybox:latest")

out := busybox.Run(llb.Shlex(`sh -e -c "[[ -f /m1/sbin/apk ]]"`))
out.AddMount("/m1", llb.Image("alpine:latest"), llb.Readonly)

def, err := out.Marshal(context.TODO())
require.NoError(t, err)

_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
require.NoError(t, err)

out = busybox.Run(llb.Shlex(`sh -e -c "[[ -f /m1/sbin/apk ]]"`))
out.AddMount("/m1", llb.Image("busybox:latest"), llb.Readonly)

def, err = out.Marshal(context.TODO())
require.NoError(t, err)

_, err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
require.Error(t, err)
}

func testCacheMountNoCache(t *testing.T, sb integration.Sandbox) {
requiresLinux(t)
c, err := New(context.TODO(), sb.Address())
Expand Down

0 comments on commit 6ab9eea

Please sign in to comment.