diff --git a/internal/resolution/entities/bundle_entity.go b/internal/resolution/entities/bundle_entity.go index b9ccf4cce..df1cc1d4e 100644 --- a/internal/resolution/entities/bundle_entity.go +++ b/internal/resolution/entities/bundle_entity.go @@ -47,23 +47,13 @@ func (g GVK) String() string { return fmt.Sprintf(`group:"%s" version:"%s" kind:"%s"`, g.Group, g.Version, g.Kind) } -type GVKRequired property.GVKRequired - -func (g GVKRequired) String() string { - return fmt.Sprintf(`group:"%s" version:"%s" kind:"%s"`, g.Group, g.Version, g.Kind) -} - -func (g GVKRequired) AsGVK() GVK { - return GVK(g) -} - type BundleEntity struct { *input.Entity // these properties are lazy loaded as they are requested bundlePackage *property.Package providedGVKs []GVK - requiredGVKs []GVKRequired + requiredGVKs []GVK requiredPackages []PackageRequired channel *property.Channel channelEntry *ChannelEntry @@ -101,7 +91,7 @@ func (b *BundleEntity) ProvidedGVKs() ([]GVK, error) { return b.providedGVKs, nil } -func (b *BundleEntity) RequiredGVKs() ([]GVKRequired, error) { +func (b *BundleEntity) RequiredGVKs() ([]GVK, error) { if err := b.loadRequiredGVKs(); err != nil { return nil, err } @@ -214,7 +204,7 @@ func (b *BundleEntity) loadRequiredGVKs() error { b.mu.Lock() defer b.mu.Unlock() if b.requiredGVKs == nil { - requiredGVKs, err := loadFromEntity[[]GVKRequired](b.Entity, property.TypeGVKRequired, optional) + requiredGVKs, err := loadFromEntity[[]GVK](b.Entity, property.TypeGVKRequired, optional) if err != nil { return fmt.Errorf("error determining bundle required gvks for entity '%s': %w", b.ID, err) } diff --git a/internal/resolution/entities/bundle_entity_test.go b/internal/resolution/entities/bundle_entity_test.go index b7b11052b..06915252d 100644 --- a/internal/resolution/entities/bundle_entity_test.go +++ b/internal/resolution/entities/bundle_entity_test.go @@ -135,7 +135,7 @@ var _ = Describe("BundleEntity", func() { bundleEntity := olmentity.NewBundleEntity(entity) requiredGvks, err := bundleEntity.RequiredGVKs() Expect(err).ToNot(HaveOccurred()) - Expect(requiredGvks).To(Equal([]olmentity.GVKRequired{ + Expect(requiredGvks).To(Equal([]olmentity.GVK{ {Group: "foo.io", Kind: "Foo", Version: "v1"}, {Group: "bar.io", Kind: "Bar", Version: "v1alpha1"}, })) @@ -326,27 +326,6 @@ var _ = Describe("BundleEntity", func() { }) }) - // Increase test coverage - Describe("GVKRequired properties", func() { - It("should return the GVKRequired properties", func() { - gvk := olmentity.GVKRequired{ - Group: "foo.io", - Kind: "Foo", - Version: "v1", - } - Expect(gvk.AsGVK().Version).To(Equal("v1")) - Expect(gvk.AsGVK().Group).To(Equal("foo.io")) - Expect(gvk.AsGVK().Kind).To(Equal("Foo")) - }) - It("should return the GVKRequired properties as a string", func() { - gvk := olmentity.GVKRequired{ - Group: "foo.io", - Kind: "Foo", - Version: "v1", - } - Expect(gvk.String()).To(Equal(`group:"foo.io" version:"v1" kind:"Foo"`)) - }) - }) Describe("GVK properties", func() { It("should return the gvk properties", func() { gvk := olmentity.GVK{ diff --git a/internal/resolution/variablesources/bundles_and_dependencies.go b/internal/resolution/variablesources/bundles_and_dependencies.go index 1f0ea8835..97b985fff 100644 --- a/internal/resolution/variablesources/bundles_and_dependencies.go +++ b/internal/resolution/variablesources/bundles_and_dependencies.go @@ -111,7 +111,7 @@ func (b *BundlesAndDepsVariableSource) getEntityDependencies(ctx context.Context // todo(perdasilva): disambiguate between not found and actual errors gvkDependencies, _ := bundleEntity.RequiredGVKs() for i := 0; i < len(gvkDependencies); i++ { - providedGvk := gvkDependencies[i].AsGVK() + providedGvk := gvkDependencies[i] gvkDependencyBundles, err := entitySource.Filter(ctx, predicates.ProvidesGVK(&providedGvk)) if err != nil { return nil, err