Skip to content

Commit

Permalink
fix(puller/tests): wait for registry to be up before running tests
Browse files Browse the repository at this point in the history
Signed-off-by: Aldo Lacuku <aldo@lacuku.eu>
  • Loading branch information
alacuku committed Nov 16, 2023
1 parent caab69f commit 620f1c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/oci/puller/puller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 620f1c6

Please sign in to comment.