Skip to content

Commit

Permalink
Fetch Rook CRDs
Browse files Browse the repository at this point in the history
  • Loading branch information
afritzler committed Apr 2, 2024
1 parent fd5fde7 commit 87c0308
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions internal/bucketserver/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"testing"
"time"

"github.com/ironcore-dev/ceph-provider/cmd/bucketprovider/app"
"github.com/ironcore-dev/controller-utils/modutils"
iriv1alpha1 "github.com/ironcore-dev/ironcore/iri/apis/bucket/v1alpha1"
"github.com/ironcore-dev/ironcore/iri/remote/bucket"
bucketv1alpha1 "github.com/kube-object-storage/lib-bucket-provisioner/pkg/apis/objectbucket.io/v1alpha1"
Expand Down Expand Up @@ -63,10 +63,28 @@ var _ = BeforeSuite(func() {

var err error

// Define temporary file for the Rook CRDs
rookCRDs, err := os.CreateTemp(GinkgoT().TempDir(), "rook-crds.yaml")
Expect(err).NotTo(HaveOccurred())
defer func() {
_ = rookCRDs.Close()
}()

// Download the Rook CRDs
rookCRDsURL := "https://raw.githubusercontent.com/rook/rook/v1.13.7/deploy/examples/crds.yaml"
response, err := http.Get(rookCRDsURL)
Expect(err).NotTo(HaveOccurred())
defer response.Body.Close()

Expect(response.StatusCode).To(Equal(http.StatusOK))

_, err = io.Copy(rookCRDs, response.Body)
Expect(err).NotTo(HaveOccurred())

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
filepath.Join(modutils.Dir("github.com/rook/rook", "deploy", "examples", "crds.yaml")),
rookCRDs.Name(),
},
ErrorIfCRDPathMissing: true,
}
Expand Down

0 comments on commit 87c0308

Please sign in to comment.