Skip to content

Commit

Permalink
add logging and thread sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Joey Brown <brown.joseph@salesforce.com>
  • Loading branch information
joeybrown-sf committed Feb 13, 2025
1 parent 2c0f9bd commit 3a09c6d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions acceptance/phase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3a09c6d

Please sign in to comment.