Merge pull request #2677 from ktock/zstdtest

test: Ensure testPullZstdImage pulls zstd image
master
Tõnis Tiigi 2022-02-25 08:50:24 -08:00 committed by GitHub
commit 6fe5f72fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -2654,12 +2654,24 @@ func testPullZstdImage(t *testing.T, sb integration.Sandbox) {
"name": target,
"push": "true",
"compression": "zstd",
// containerd applier supports only zstd with oci-mediatype.
"oci-mediatypes": "true",
},
},
},
}, nil)
require.NoError(t, err)
if sb.Name() == "containerd-1.4" {
// containerd 1.4 doesn't support zstd compression
return
}
err = c.Prune(sb.Context(), nil, PruneAll)
require.NoError(t, err)
checkAllRemoved(t, c, sb)
st = llb.Scratch().File(llb.Copy(llb.Image(target), "/data", "/zdata"))
def, err = st.Marshal(sb.Context())

View File

@ -51,6 +51,7 @@ type Sandbox interface {
PrintLogs(*testing.T)
NewRegistry() (string, error)
Value(string) interface{} // chosen matrix value
Name() string
}
// BackendConfig is used to configure backends created by a worker.

View File

@ -51,6 +51,11 @@ type sandbox struct {
cleanup *multiCloser
mv matrixValue
ctx context.Context
name string
}
func (sb *sandbox) Name() string {
return sb.name
}
func (sb *sandbox) Context() context.Context {
@ -135,6 +140,7 @@ func newSandbox(ctx context.Context, w Worker, mirror string, mv matrixValue) (s
cleanup: deferF,
mv: mv,
ctx: ctx,
name: w.Name(),
}, cl, nil
}