Skip to content

Commit

Permalink
Update catalogd dep to v0.13.0
Browse files Browse the repository at this point in the history
Fix references to Catalog and CatalogSpec
  • Loading branch information
trgeiger committed May 20, 2024
1 parent be699b1 commit a91c188
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/blang/semver/v4 v4.0.0
github.com/go-logr/logr v1.4.1
github.com/google/go-cmp v0.6.0
github.com/operator-framework/catalogd v0.12.0
github.com/operator-framework/catalogd v0.13.0
github.com/operator-framework/operator-registry v1.40.0
github.com/operator-framework/rukpak v0.20.0
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/operator-framework/api v0.23.0 h1:kHymOwcHBpBVujT49SKOCd4EVG7Odwj4wl3NbOR2LLA=
github.com/operator-framework/api v0.23.0/go.mod h1:oKcFOz+Xc1UhMi2Pzcp6qsO7wjS4r+yP7EQprQBXrfM=
github.com/operator-framework/catalogd v0.12.0 h1:Cww+CyowkfTFugB9ZjUDpKvumh2vPe/TjCUpMHDmVBM=
github.com/operator-framework/catalogd v0.12.0/go.mod h1:4lryGtBTVOdqlKR0MaVYnlsSOc7HiagVRVo3J4uIo7E=
github.com/operator-framework/catalogd v0.13.0 h1:yOhEb0LpvGbZymippotpau5gFMyUnq8zMnrEYrTaJIQ=
github.com/operator-framework/catalogd v0.13.0/go.mod h1:v405w8d89Lr7K8IVE/x/Q37JtxvgdzLXGpgJxJ2Nweg=
github.com/operator-framework/operator-registry v1.40.0 h1:CaYNE4F/jzahpC7UCILItaIHmB5/oE0sS066nK+5Glw=
github.com/operator-framework/operator-registry v1.40.0/go.mod h1:D2YxapkfRDgjqNTO9d3h3v0DeREbV+8utCLG52zrOy4=
github.com/operator-framework/rukpak v0.20.0 h1:BqF1nIlocyYLMmv6CvlbtB9QTwSMrEfTzhA+H3+do3c=
Expand Down
2 changes: 1 addition & 1 deletion internal/catalogmetadata/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type filesystemCache struct {
// resources that have been successfully reconciled, unpacked, and are being served.
// These requirements help ensure that we can rely on status conditions to determine
// when to issue a request to update the cached Catalog contents.
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
if catalog == nil {
return nil, fmt.Errorf("error: provided catalog must be non-nil")
}
Expand Down
30 changes: 15 additions & 15 deletions internal/catalogmetadata/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestCache(t *testing.T) {
t.Run("FetchCatalogContents", func(t *testing.T) {
type test struct {
name string
catalog *catalogd.Catalog
catalog *catalogd.ClusterCatalog
contents []byte
wantErr bool
tripper *MockTripper
Expand All @@ -64,11 +64,11 @@ func TestCache(t *testing.T) {
for _, tt := range []test{
{
name: "valid non-cached fetch",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -82,11 +82,11 @@ func TestCache(t *testing.T) {
},
{
name: "valid cached fetch",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -102,11 +102,11 @@ func TestCache(t *testing.T) {
},
{
name: "cached update fetch with changes",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -122,11 +122,11 @@ func TestCache(t *testing.T) {
},
{
name: "fetch error",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -141,11 +141,11 @@ func TestCache(t *testing.T) {
},
{
name: "fetch internal server error response",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ResolvedImageSource{
Expand All @@ -167,11 +167,11 @@ func TestCache(t *testing.T) {
},
{
name: "nil catalog.status.resolvedSource",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: nil,
},
},
Expand All @@ -181,11 +181,11 @@ func TestCache(t *testing.T) {
},
{
name: "nil catalog.status.resolvedSource.image",
catalog: &catalogd.Catalog{
catalog: &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "test-catalog",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
ResolvedSource: &catalogd.ResolvedCatalogSource{
Image: nil,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/catalogmetadata/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Fetcher interface {
// server for the catalog provided. It returns an io.ReadCloser
// containing the FBC contents that the caller is expected to close.
// returns an error if any occur.
FetchCatalogContents(ctx context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error)
FetchCatalogContents(ctx context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error)
}

func New(cl client.Client, fetcher Fetcher) *Client {
Expand All @@ -46,7 +46,7 @@ type Client struct {
func (c *Client) Bundles(ctx context.Context) ([]*catalogmetadata.Bundle, error) {
var allBundles []*catalogmetadata.Bundle

var catalogList catalogd.CatalogList
var catalogList catalogd.ClusterCatalogList
if err := c.cl.List(ctx, &catalogList); err != nil {
return nil, err
}
Expand Down
12 changes: 6 additions & 6 deletions internal/catalogmetadata/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestClient(t *testing.T) {
name: "skip catalog missing Unpacked status condition",
fakeCatalog: func() ([]client.Object, []*catalogmetadata.Bundle, map[string][]byte) {
objs, bundles, catalogContentMap := defaultFakeCatalog()
objs = append(objs, &catalogd.Catalog{
objs = append(objs, &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "foobar",
},
Expand Down Expand Up @@ -220,11 +220,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
}`

objs := []client.Object{
&catalogd.Catalog{
&catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog-1",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
Conditions: []metav1.Condition{
{
Type: catalogd.TypeUnpacked,
Expand All @@ -234,11 +234,11 @@ func defaultFakeCatalog() ([]client.Object, []*catalogmetadata.Bundle, map[strin
},
},
},
&catalogd.Catalog{
&catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: "catalog-2",
},
Status: catalogd.CatalogStatus{
Status: catalogd.ClusterCatalogStatus{
Conditions: []metav1.Condition{
{
Type: catalogd.TypeUnpacked,
Expand Down Expand Up @@ -338,7 +338,7 @@ type MockFetcher struct {
shouldError bool
}

func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.Catalog) (io.ReadCloser, error) {
func (mc *MockFetcher) FetchCatalogContents(_ context.Context, catalog *catalogd.ClusterCatalog) (io.ReadCloser, error) {
if mc.shouldError {
return nil, errors.New("mock cache error")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/clusterextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,12 @@ func (r *ClusterExtensionReconciler) GenerateExpectedBundleDeployment(o ocv1alph
func (r *ClusterExtensionReconciler) SetupWithManager(mgr ctrl.Manager) error {
err := ctrl.NewControllerManagedBy(mgr).
For(&ocv1alpha1.ClusterExtension{}).
Watches(&catalogd.Catalog{},
Watches(&catalogd.ClusterCatalog{},
handler.EnqueueRequestsFromMapFunc(clusterExtensionRequestsForCatalog(mgr.GetClient(), mgr.GetLogger()))).
WithEventFilter(predicate.Funcs{
UpdateFunc: func(ue event.UpdateEvent) bool {
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.Catalog)
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.Catalog)
oldObject, isOldCatalog := ue.ObjectOld.(*catalogd.ClusterCatalog)
newObject, isNewCatalog := ue.ObjectNew.(*catalogd.ClusterCatalog)

if !isOldCatalog || !isNewCatalog {
return true
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/cluster_extension_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
var pollDuration = time.Minute
var pollInterval = time.Second

func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, string, *catalogd.Catalog) {
func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, string, *catalogd.ClusterCatalog) {
var err error
extensionCatalog, err := createTestCatalog(context.Background(), testCatalogName, os.Getenv(testCatalogRefEnvVar))
require.NoError(t, err)
Expand All @@ -51,10 +51,10 @@ func testInit(t *testing.T) (*ocv1alpha1.ClusterExtension, string, *catalogd.Cat
return clusterExtension, clusterExtensionName, extensionCatalog
}

func testCleanup(t *testing.T, cat *catalogd.Catalog, clusterExtension *ocv1alpha1.ClusterExtension) {
func testCleanup(t *testing.T, cat *catalogd.ClusterCatalog, clusterExtension *ocv1alpha1.ClusterExtension) {
require.NoError(t, c.Delete(context.Background(), cat))
require.Eventually(t, func() bool {
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.Catalog{})
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.ClusterCatalog{})
return errors.IsNotFound(err)
}, pollDuration, pollInterval)
require.NoError(t, c.Delete(context.Background(), clusterExtension))
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
t.Log("By deleting the catalog first")
require.NoError(t, c.Delete(context.Background(), extensionCatalog))
require.EventuallyWithT(t, func(ct *assert.CollectT) {
err := c.Get(context.Background(), types.NamespacedName{Name: extensionCatalog.Name}, &catalogd.Catalog{})
err := c.Get(context.Background(), types.NamespacedName{Name: extensionCatalog.Name}, &catalogd.ClusterCatalog{})
assert.True(ct, errors.IsNotFound(err))
}, pollDuration, pollInterval)

Expand Down Expand Up @@ -367,7 +367,7 @@ func getArtifactsOutput(t *testing.T) {
}

// get all catalogsources save them to the artifact path.
catalogsources := catalogd.CatalogList{}
catalogsources := catalogd.ClusterCatalogList{}
if err := c.List(context.Background(), &catalogsources, client.InNamespace("")); err != nil {
fmt.Printf("Failed to list catalogsources: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cluster_extension_registryV1_limitations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
func TestClusterExtensionPackagesWithWebhooksAreNotAllowed(t *testing.T) {
ctx := context.Background()
catalog, err := createTestCatalog(ctx, testCatalogName, os.Getenv(testCatalogRefEnvVar))
defer func(cat *catalogd.Catalog) {
defer func(cat *catalogd.ClusterCatalog) {
require.NoError(t, c.Delete(context.Background(), cat))
require.Eventually(t, func() bool {
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.Catalog{})
err := c.Get(context.Background(), types.NamespacedName{Name: cat.Name}, &catalogd.ClusterCatalog{})
return errors.IsNotFound(err)
}, pollDuration, pollInterval)
}(catalog)
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func TestMain(m *testing.M) {
// createTestCatalog will create a new catalog on the test cluster, provided
// the context, catalog name, and the image reference. It returns the created catalog
// or an error if any errors occurred while creating the catalog.
func createTestCatalog(ctx context.Context, name string, imageRef string) (*catalogd.Catalog, error) {
catalog := &catalogd.Catalog{
func createTestCatalog(ctx context.Context, name string, imageRef string) (*catalogd.ClusterCatalog, error) {
catalog := &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: catalogd.CatalogSpec{
Spec: catalogd.ClusterCatalogSpec{
Source: catalogd.CatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ImageSource{
Expand Down
4 changes: 2 additions & 2 deletions test/extension-developer-e2e/extension_developer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func TestExtensionDeveloper(t *testing.T) {
clusterExtension := ce
t.Run(clusterExtension.ObjectMeta.Name, func(t *testing.T) {
t.Parallel()
catalog := &catalogd.Catalog{
catalog := &catalogd.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "catalog",
},
Spec: catalogd.CatalogSpec{
Spec: catalogd.ClusterCatalogSpec{
Source: catalogd.CatalogSource{
Type: catalogd.SourceTypeImage,
Image: &catalogd.ImageSource{
Expand Down

0 comments on commit a91c188

Please sign in to comment.