-
Notifications
You must be signed in to change notification settings - Fork 60
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
🌱 Part 4: Reduce number of variable sources. Required packages #500
🌱 Part 4: Reduce number of variable sources. Required packages #500
Conversation
1ba218a
to
764afee
Compare
9e70605
to
fb7fc7d
Compare
90de92a
to
dfee29b
Compare
dfee29b
to
7fc644a
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #500 +/- ##
==========================================
+ Coverage 84.45% 85.21% +0.76%
==========================================
Files 23 23
Lines 907 893 -14
==========================================
- Hits 766 761 -5
+ Misses 96 91 -5
+ Partials 45 41 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1e883c2
to
1a29986
Compare
Signed-off-by: Mikalai Radchuk <[email protected]>
1a29986
to
6585f6e
Compare
@@ -83,7 +83,7 @@ var _ = Describe("Operator Controller Test", func() { | |||
By("running reconcile") | |||
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: opKey}) | |||
Expect(res).To(Equal(ctrl.Result{})) | |||
Expect(err).To(MatchError(fmt.Sprintf("no package '%s' found", pkgName))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I had similar comments on previous parts of this refactoring & most of our errors use double quotation marks I updated the format here.
I'm happy to revert this and move into a separate PR if this is too distracting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on keeping this
if versionRange != "" && channelName != "" { | ||
return nil, fmt.Errorf("no package %q matching version %q found in channel %q", packageName, versionRange, channelName) | ||
} | ||
if versionRange != "" { | ||
return nil, fmt.Errorf("no package %q matching version %q found", packageName, versionRange) | ||
} | ||
if channelName != "" { | ||
return nil, fmt.Errorf("no package %q found in channel %q", packageName, channelName) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about building up the error message as we're building the predicates (since we're already making the necessary conditional checks as we go)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm not in favour of this approach because:
- There are more combinations of errors than we have conditions for predicates. Unless I'm missing something, we will have to add more
if
s under existing predicateif
s to get equivalent behaviour - Might be just me, but when I debug an error or read code I appreicate when codebase has unique errors and it is clear which condition yields the error. I found it quite hard to follow what was going on with errors in this PoC which had similar approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the emphasis on readability here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @m1kola
For some reasons jobs in the merge queue did not get triggered. Probably will have to wait for it to timeout and requeue again. |
Description
Spliting #460 into smaller chunks. Related to #437
In this part I extract code related to creating required package variables from
RequiredPackageVariableSource
andOperatorVariableSource
into a separate function.RequiredPackageVariableSource
gets removed in this PR.OperatorVariableSource
will be removed later in #501Reviewer Checklist