From a5456d31eabd4cc7449159b0689ebdc4097a6e76 Mon Sep 17 00:00:00 2001 From: Aaron Prindle Date: Tue, 19 Dec 2023 08:16:03 -0800 Subject: [PATCH] fix: resolve integration test issue issue where container-diff cannot pull OCI images properly from registry (#2918) --- integration/integration_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/integration/integration_test.go b/integration/integration_test.go index 653a1f91f..fe3adbdf6 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -1077,6 +1077,21 @@ func meetsRequirements() bool { // containerDiff compares the container images image1 and image2. func containerDiff(t *testing.T, image1, image2 string, flags ...string) []byte { + // workaround for container-diff OCI issue https://github.com/GoogleContainerTools/container-diff/issues/389 + if !strings.HasPrefix(image1, daemonPrefix) { + dockerPullCmd := exec.Command("docker", "pull", image1) + out := RunCommand(dockerPullCmd, t) + t.Logf("docker pull cmd output for image1 = %s", string(out)) + image1 = daemonPrefix + image1 + } + + if !strings.HasPrefix(image2, daemonPrefix) { + dockerPullCmd := exec.Command("docker", "pull", image2) + out := RunCommand(dockerPullCmd, t) + t.Logf("docker pull cmd output for image2 = %s", string(out)) + image2 = daemonPrefix + image2 + } + flags = append([]string{"diff"}, flags...) flags = append(flags, image1, image2, "-q", "--type=file", "--type=metadata", "--json")