mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
TestBuildUserNamespaceValidateCapabilitiesAreV2: verify build completed
Check if the `docker build` completed successfully before continuing. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
26965fbfa0
commit
fa480403c7
1 changed files with 8 additions and 21 deletions
|
@ -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"
|
||||
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue