From 117c9016e1dc4e851c4fb6db6d41b1ef02237331 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 29 May 2024 21:56:22 -0400 Subject: [PATCH] Updated tests further to make sure the new flag doesn't affect copy an index regardless of what value you specify. Signed-off-by: Tim Smith --- tests/imagetools.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/imagetools.go b/tests/imagetools.go index 2f423acb..aa378bda 100644 --- a/tests/imagetools.go +++ b/tests/imagetools.go @@ -140,6 +140,24 @@ func testImagetoolsCopyIndex(t *testing.T, sb integration.Sandbox) { for i := range idx.Manifests { require.Equal(t, idx.Manifests[i].Digest, idx2.Manifests[i].Digest) } + + cmd = buildxCmd(sb, withArgs("imagetools", "create", "--prefer-index=false", "-t", target2+"-still-index", target)) + dt, err = cmd.CombinedOutput() + require.NoError(t, err, string(dt)) + + cmd = buildxCmd(sb, withArgs("imagetools", "inspect", target2+"-still-index", "--raw")) + dt, err = cmd.CombinedOutput() + require.NoError(t, err, string(dt)) + + var idx3 ocispecs.Index + err = json.Unmarshal(dt, &idx3) + require.NoError(t, err) + require.Equal(t, images.MediaTypeDockerSchema2ManifestList, idx3.MediaType) + + require.Equal(t, len(idx.Manifests), len(idx3.Manifests)) + for i := range idx.Manifests { + require.Equal(t, idx.Manifests[i].Digest, idx3.Manifests[i].Digest) + } } func testImagetoolsInspectAndFilter(t *testing.T, sb integration.Sandbox) {