From 09f282e468bd7d77d52593e68a121497eb703b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Fri, 2 Feb 2024 23:23:48 +0100 Subject: [PATCH] Split decompressDir from runDecompressDirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that we have a new function which only decompresses one image at a time. Signed-off-by: Miloslav Trmač --- integration/utils.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/integration/utils.go b/integration/utils.go index 4a7e0372..5532425f 100644 --- a/integration/utils.go +++ b/integration/utils.go @@ -194,19 +194,25 @@ func runDecompressDirs(t *testing.T, args ...string) { m, err := os.ReadFile(filepath.Join(dir, "manifest.json")) require.NoError(t, err) t.Logf("manifest %d before: %s", i+1, string(m)) - } - out, err := exec.Command(decompressDirsBinary, args...).CombinedOutput() - assert.NoError(t, err, "%s", out) - for i, dir := range args { - if len(out) > 0 { - t.Logf("output: %s", out) - } - m, err := os.ReadFile(filepath.Join(dir, "manifest.json")) + + decompressDir(t, dir) + + m, err = os.ReadFile(filepath.Join(dir, "manifest.json")) require.NoError(t, err) t.Logf("manifest %d after: %s", i+1, string(m)) } } +// decompressDir modifies a dir:-formatted directory to replace gzip-compressed layers with uncompressed variants, +// and to use a ~canonical formatting of manifest.json. +func decompressDir(t *testing.T, dir string) { + out, err := exec.Command(decompressDirsBinary, dir).CombinedOutput() + assert.NoError(t, err, "%s", out) + if len(out) > 0 { + t.Logf("output: %s", out) + } +} + // Verify manifest in a dir: image at dir is expectedMIMEType. func verifyManifestMIMEType(t *testing.T, dir string, expectedMIMEType string) { manifestBlob, err := os.ReadFile(filepath.Join(dir, "manifest.json"))