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"))