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

Fixes semver range parsing for required packages #423

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

m1kola
Copy link
Member

@m1kola m1kola commented Sep 20, 2023

Description

Moving fix from #413 into a separate PR.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.19% ⚠️

Comparison is base (cdb99fa) 83.97% compared to head (a603662) 83.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #423      +/-   ##
==========================================
- Coverage   83.97%   83.78%   -0.19%     
==========================================
  Files          27       27              
  Lines        1073     1073              
==========================================
- Hits          901      899       -2     
- Misses        119      120       +1     
- Partials       53       54       +1     
Flag Coverage Δ
e2e 61.60% <ø> (-0.23%) ⬇️
unit 80.34% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
internal/catalogmetadata/types.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -31,7 +31,7 @@ type Channel struct {

type PackageRequired struct {
property.PackageRequired
SemverRange *bsemver.Range `json:"-"`
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we need a pointer to a function here.

err,
)
}
requiredPackage.SemverRange = &semverRange
Copy link
Member Author

@m1kola m1kola Sep 20, 2023

Choose a reason for hiding this comment

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

So the issue is that we were setting SemverRange on a copy and not on the instance from requiredPackages.

I think we have the same issue in master here:

for _, requiredPackage := range requiredPackages {
semverRange, err := bsemver.ParseRange(requiredPackage.VersionRange)
if err != nil {
return fmt.Errorf("error determining bundle required package semver range for entity '%s': '%w'", b.ID, err)
}
requiredPackage.SemverRange = &semverRange
}

But I believe it is unused currently in master since we do parsing here anyway:

semverRange, err := bsemver.ParseRange(requiredPackage.VersionRange)
if err != nil {
return nil, err
}

Not going to submit a PR for bundle_entity.go since it is going away as soon as #413 merges.

Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
@m1kola m1kola marked this pull request as ready for review September 20, 2023 12:24
@m1kola m1kola requested a review from a team as a code owner September 20, 2023 12:24
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
Copy link
Contributor

@perdasilva perdasilva left a comment

Choose a reason for hiding this comment

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

lgtm

@m1kola m1kola added this pull request to the merge queue Sep 20, 2023
Merged via the queue into operator-framework:main with commit 1e12a2a Sep 20, 2023
11 of 12 checks passed
@m1kola m1kola deleted the RequiredPackages_fixup branch September 20, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants