From 35f658525b4053daab2535a5cdaab26253fc920a Mon Sep 17 00:00:00 2001 From: Kohei Tokunaga Date: Fri, 25 Feb 2022 17:11:58 +0900 Subject: [PATCH] test: Ensure testPullZstdImage pulls zstd image Signed-off-by: Kohei Tokunaga --- client/client_test.go | 12 ++++++++++++ util/testutil/integration/run.go | 1 + util/testutil/integration/sandbox.go | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/client/client_test.go b/client/client_test.go index 4ef0f667..ea901ccb 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -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()) diff --git a/util/testutil/integration/run.go b/util/testutil/integration/run.go index 1e9cce49..50d355e4 100644 --- a/util/testutil/integration/run.go +++ b/util/testutil/integration/run.go @@ -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. diff --git a/util/testutil/integration/sandbox.go b/util/testutil/integration/sandbox.go index 8367f928..8896ec62 100644 --- a/util/testutil/integration/sandbox.go +++ b/util/testutil/integration/sandbox.go @@ -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 }