From c3ba0221ec4e6fe0fb9d6b21fa01ce866c5cc602 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Mon, 23 Oct 2023 19:21:24 -0600 Subject: [PATCH] ginkgo setup: retry cache pulls Because all registries flake. Signed-off-by: Ed Santiago --- test/e2e/common_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 713c56ea22..021bd1d25f 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -412,9 +412,19 @@ func (p *PodmanTestIntegration) createArtifact(image string) { destName := imageTarPath(image) if _, err := os.Stat(destName); os.IsNotExist(err) { GinkgoWriter.Printf("Caching %s at %s...\n", image, destName) - pull := p.PodmanNoCache([]string{"pull", image}) - pull.Wait(440) - Expect(pull).Should(Exit(0)) + for try := 0; try < 3; try++ { + pull := p.PodmanNoCache([]string{"pull", image}) + pull.Wait(440) + if pull.ExitCode() == 0 { + break + } + if try == 2 { + Expect(pull).Should(Exit(0), "Failed after many retries") + } + + GinkgoWriter.Println("Will wait and retry") + time.Sleep(time.Duration(try+1) * 5 * time.Second) + } save := p.PodmanNoCache([]string{"save", "-o", destName, image}) save.Wait(90)