Add an integration test for pulling schema1 images

Signed-off-by: Ian Campbell <ijc@docker.com>
docker-18.09
Ian Campbell 2018-03-02 16:33:08 +00:00
parent b7632ad036
commit ae0293c4bf
2 changed files with 20 additions and 1 deletions

View File

@ -42,6 +42,7 @@ func TestClientIntegration(t *testing.T) {
testOCIExporter,
testWhiteoutParentDir,
testDuplicateWhiteouts,
testSchema1Image,
})
}
@ -686,6 +687,24 @@ func testWhiteoutParentDir(t *testing.T, sb integration.Sandbox) {
require.True(t, ok)
}
// #296
func testSchema1Image(t *testing.T, sb integration.Sandbox) {
t.Parallel()
c, err := New(sb.Address())
require.NoError(t, err)
defer c.Close()
st := llb.Image("gcr.io/google_containers/pause:3.0@sha256:0d093c962a6c2dd8bb8727b661e2b5f13e9df884af9945b4cc7088d9350cd3ee")
def, err := st.Marshal()
require.NoError(t, err)
err = c.Solve(context.TODO(), def, SolveOpt{}, nil)
require.NoError(t, err)
checkAllReleasable(t, c, sb, true)
}
func requiresLinux(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skipf("unsupported GOOS: %s", runtime.GOOS)

View File

@ -240,9 +240,9 @@ func (p *puller) Snapshot(ctx context.Context) (cache.ImmutableRef, error) {
handlers := []images.Handler{
images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
usedBlobs = append(usedBlobs, desc)
mu.Lock()
defer mu.Unlock()
usedBlobs = append(usedBlobs, desc)
delete(allBlobs, desc.Digest)
return nil, nil
}),