From 3a09c6dc98ec2b55d5d6809d03cc9fa0a9f748c2 Mon Sep 17 00:00:00 2001 From: Joey Brown Date: Thu, 13 Feb 2025 10:17:05 -0600 Subject: [PATCH] add logging and thread sleep Signed-off-by: Joey Brown --- acceptance/phase_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/acceptance/phase_test.go b/acceptance/phase_test.go index 47c8d0f7c..a54e508e9 100644 --- a/acceptance/phase_test.go +++ b/acceptance/phase_test.go @@ -17,6 +17,8 @@ import ( "testing" "time" + "github.com/docker/docker/api/types/image" + ih "github.com/buildpacks/imgutil/testhelpers" "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/registry" @@ -434,6 +436,22 @@ func assertImageOSAndArch(t *testing.T, imageName string, phaseTest *PhaseTest) func assertImageOSAndArchAndCreatedAt(t *testing.T, imageName string, phaseTest *PhaseTest, expectedCreatedAt time.Time) { //nolint inspect, _, err := h.DockerCli(t).ImageInspectWithRaw(context.TODO(), imageName) + + if err != nil { + list, _ := h.DockerCli(t).ImageList(context.TODO(), image.ListOptions{}) + fmt.Println("Error encountered running ImageInspectWithRaw. imageName: ", imageName) + fmt.Println(err) + for _, value := range list { + fmt.Println("Image Name: ", value) + } + + if strings.Contains(err.Error(), "No such image") { + t.Log("Image not found, retrying...") + time.Sleep(1 * time.Second) + inspect, _, err = h.DockerCli(t).ImageInspectWithRaw(context.TODO(), imageName) + } + } + h.AssertNil(t, err) h.AssertEq(t, inspect.Os, phaseTest.targetDaemon.os) h.AssertEq(t, inspect.Architecture, phaseTest.targetDaemon.arch)