Merge pull request #41936 from thaJeztah/fix_image_reference

This commit is contained in:
Brian Goff 2021-02-16 09:39:19 -08:00 committed by GitHub
commit 3d96682687
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/docker/testutil/daemon"
"github.com/docker/docker/testutil/fakecontext"
@ -41,7 +42,7 @@ func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
ctx := context.Background()
clientUserRemap := dUserRemap.NewClientT(t)
err = load.FrozenImagesLinux(clientUserRemap, "buildpack-deps:buster")
err = load.FrozenImagesLinux(clientUserRemap, "debian:bullseye")
assert.NilError(t, err)
dUserRemapRunning := true
@ -66,17 +67,10 @@ func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
})
assert.NilError(t, err)
defer resp.Body.Close()
buf := make([]byte, 1024)
for {
n, err := resp.Body.Read(buf)
if err != nil && err != io.EOF {
t.Fatalf("Error reading ImageBuild response: %v", err)
break
}
if n == 0 {
break
}
}
buf := bytes.NewBuffer(nil)
err = jsonmessage.DisplayJSONMessagesStream(resp.Body, buf, 0, false, nil)
assert.NilError(t, err)
reader, err := clientUserRemap.ImageSave(ctx, []string{imageTag})
assert.NilError(t, err, "failed to download capabilities image")
@ -106,16 +100,9 @@ func TestBuildUserNamespaceValidateCapabilitiesAreV2(t *testing.T) {
loadResp, err := clientNoUserRemap.ImageLoad(ctx, tarReader, false)
assert.NilError(t, err, "failed to load image tar file")
defer loadResp.Body.Close()
for {
n, err := loadResp.Body.Read(buf)
if err != nil && err != io.EOF {
t.Fatalf("Error reading ImageLoad response: %v", err)
break
}
if n == 0 {
break
}
}
buf = bytes.NewBuffer(nil)
err = jsonmessage.DisplayJSONMessagesStream(loadResp.Body, buf, 0, false, nil)
assert.NilError(t, err)
cid := container.Run(ctx, t, clientNoUserRemap,
container.WithImage(imageTag),