Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates deppy #249

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/onsi/ginkgo/v2 v2.8.3
github.com/onsi/gomega v1.27.1
github.com/operator-framework/catalogd v0.2.0
github.com/operator-framework/deppy v0.0.0-20230125110717-dc02e928470f
github.com/operator-framework/deppy v0.0.0-20230602120738-cbf2c66b141b
github.com/operator-framework/operator-registry v1.26.3
github.com/operator-framework/rukpak v0.12.0
go.uber.org/zap v1.24.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754=
github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw=
github.com/operator-framework/catalogd v0.2.0 h1:1uroX6DfHh+/PnEAQMLTpkx67Mwn3ZMTPFXSbZwmYAs=
github.com/operator-framework/catalogd v0.2.0/go.mod h1:RIrm+yaMDa9ZMDIKGH8JL4Eg3zwUHKaJxonTXeK+5k8=
github.com/operator-framework/deppy v0.0.0-20230125110717-dc02e928470f h1:YxUZyQjF2kT2hli9ceBkuK7Mmiln0lV2RV38rzBObBI=
github.com/operator-framework/deppy v0.0.0-20230125110717-dc02e928470f/go.mod h1:JaF7sX6tn7mpXcOehYjSHiKM1Y0z09vEfC6dca4AVuo=
github.com/operator-framework/deppy v0.0.0-20230602120738-cbf2c66b141b h1:m7MhK8IJx9Abb0ULbUw8vXqGMP1S9bodLrKh5d6wk6k=
github.com/operator-framework/deppy v0.0.0-20230602120738-cbf2c66b141b/go.mod h1:9xVfBnKK/p6M/vQlsHqscslUtUYnK2is5D24liQBtoE=
github.com/operator-framework/operator-registry v1.26.3 h1:U+HTGgjAT5RCXU2WkDwa525wcqdo97BsO7WfMhwL5MA=
github.com/operator-framework/operator-registry v1.26.3/go.mod h1:DZcTzhAyZf/NLi2UwBQA1F/qh4FwgYBcgBx2yBz8I+Q=
github.com/operator-framework/rukpak v0.12.0 h1:qzM18RQZdqS00/6GLkEiTZf0pHtQ5bVg/DLzAmho+jQ=
Expand Down
2 changes: 1 addition & 1 deletion internal/resolution/entitysources/catalogdsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewCatalogdEntitySource(client client.Client) *catalogdEntitySource {
return &catalogdEntitySource{client: client}
}

func (es *catalogdEntitySource) Get(ctx context.Context, id deppy.Identifier) *input.Entity {
func (es *catalogdEntitySource) Get(ctx context.Context, id deppy.Identifier) (*input.Entity, error) {
panic("not implemented")
}

Expand Down
5 changes: 1 addition & 4 deletions internal/resolution/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ func (o *OperatorResolver) Resolve(ctx context.Context) (*solver.Solution, error
}

olmVariableSource := olm.NewOLMVariableSource(operatorList.Items...)
deppySolver, err := solver.NewDeppySolver(o.entitySource, olmVariableSource)
if err != nil {
return nil, err
}
deppySolver := solver.NewDeppySolver(o.entitySource, olmVariableSource)

solution, err := deppySolver.Solve(ctx)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/resolution/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ var _ input.EntitySource = &FailEntitySource{}

type FailEntitySource struct{}

func (f FailEntitySource) Get(ctx context.Context, id deppy.Identifier) *input.Entity {
return nil
func (f FailEntitySource) Get(ctx context.Context, id deppy.Identifier) (*input.Entity, error) {
return nil, fmt.Errorf("error calling get in entity source")
}

func (f FailEntitySource) Filter(ctx context.Context, filter input.Predicate) (input.EntityList, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ var _ input.EntitySource = &PanicEntitySource{}

type PanicEntitySource struct{}

func (p PanicEntitySource) Get(ctx context.Context, id deppy.Identifier) *input.Entity {
return nil
func (p PanicEntitySource) Get(ctx context.Context, id deppy.Identifier) (*input.Entity, error) {
return nil, fmt.Errorf("if you are seeing this it is because the global variable source is calling the entity source - this shouldn't happen")
}

func (p PanicEntitySource) Filter(ctx context.Context, filter input.Predicate) (input.EntityList, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/resolution/variable_sources/olm/olm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ var _ input.EntitySource = &FailEntitySource{}
type FailEntitySource struct {
}

func (f FailEntitySource) Get(ctx context.Context, id deppy.Identifier) *input.Entity {
return nil
func (f FailEntitySource) Get(ctx context.Context, id deppy.Identifier) (*input.Entity, error) {
return nil, fmt.Errorf("error executing get")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker at all: but do we want to define this as constants?
panicEntitySrcErr, FailEntitySrcErr etc.. just in case we want to use it in tests to assert the errors.

Copy link
Member Author

@m1kola m1kola Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how it might be useful, but I would like to avoid doing it in this PR. Focus of this is to upgrade Deppy with minimal changes to operator controller.

This function follows the existing pattern (see Filter, GroupBy, etc below).

}

func (f FailEntitySource) Filter(ctx context.Context, filter input.Predicate) (input.EntityList, error) {
Expand Down