diff --git a/pkg/oci/puller/puller_suite_test.go b/pkg/oci/puller/puller_suite_test.go index 113e3fda..9c617a9b 100644 --- a/pkg/oci/puller/puller_suite_test.go +++ b/pkg/oci/puller/puller_suite_test.go @@ -18,9 +18,11 @@ package puller_test import ( "context" "fmt" + "net/http" "os" "path/filepath" "testing" + "time" "github.com/distribution/distribution/v3/configuration" _ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory" @@ -79,6 +81,14 @@ var _ = BeforeSuite(func() { Expect(err).ToNot(BeNil()) }() + // Check that the registry is up and accepting connections. + Eventually(func(g Gomega) error { + res, err := http.Get(fmt.Sprintf("http://%s", config.HTTP.Addr)) + g.Expect(err).ShouldNot(HaveOccurred()) + g.Expect(res.StatusCode).Should(Equal(http.StatusOK)) + return err + }).WithTimeout(time.Second * 5).ShouldNot(HaveOccurred()) + // Create the temporary dir where artifacts are saved. destinationDir, err = os.MkdirTemp("", "falcoctl-puller-tests-") Expect(err).ShouldNot(HaveOccurred())