-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for EndpointSlices #3260
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3260 +/- ##
==========================================
+ Coverage 52.66% 52.89% +0.22%
==========================================
Files 59 59
Lines 16117 16137 +20
==========================================
+ Hits 8488 8535 +47
+ Misses 7345 7316 -29
- Partials 284 286 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
how about:
func TestGetEndpointsFromEndpointSlieces_ErrorsOnInvalidInput(t *testing.T) {
// content goes here
}
Since we are interested to test if the method errors on invalid inputs (sourced from "table tests") how about:
_, err := lbc.getEndpointsForPortFromEndpointSlices(....)
if err == nil {
t.Error("want error, got nil")
}
Since we are interested in the fact that the func returns an error, lines 743...745 seem to be of no use.
In general, it may be worth to leverage cmp.Equal
method since we use the cmp
package anyway. How about:
if !cmp.Equal(want, got) {
t.Error(cmp.Diff(want, got))
}
Note, that we defer calculating Diff, and do so only if the test fails. Checking for equality is cheeper comparing to calculating Diff
.
Just food for thought.
On line 745... it is worth to ask a question: "Do we really care what message we get?" Do we run any business logic (decision) based on this error? If yes, this may be a candidate for using sentinel errors, and would require to check what type of the error we get (errors.Is()
method from the errors package.
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.
🚀
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.
🚀 great! 👍🏻
Proposed changes
This PR updates the Ingress Controller to support EndpointSlices
Checklist
Before creating a PR, run through this checklist and mark each as complete.