-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Extract validateNodeIP test to node status test file. #46903
Conversation
/release-note-none |
Related to #40780 |
pkg/kubelet/kubelet_node_status.go
Outdated
@@ -976,7 +976,6 @@ func (kl *Kubelet) validateNodeIP() error { | |||
var ip net.IP | |||
switch v := addr.(type) { | |||
case *net.IPNet: | |||
ip = v.IP |
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.
Golang doesn't fallthrough. By removing this line, you're ignoring all net.IPNet
addressses, which I don't think is the intent?
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.
Done
nodeIP: "1.2.3.4", | ||
success: false, | ||
testName: "IPv4 address that doesn't belong to host", | ||
}, |
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.
It would be good to have 1 test case that actually checks a valid IP. UNfortunately theres no way to mock golang net.InterfaceAddrs
, so choices are to either pick an address to use in the unit test, or change the validateNodeIP() method to take a list of host interface addrs.
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.
Seems mock golang net.InterfaceAddrs
maybe better as this can make the caller simple. But I found that many places calling net.InterfaceAddrs()
does not have such a unit test, how about file another issue to handle this?
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.
Sure. It worries me that all tests (even the e2e's ??) passed with the fallthrough issue though.
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.
Yes, I filed an issue #48315 here to trace
/retest |
1 similar comment
/retest |
/lgtm |
/retest |
4 similar comments
/retest |
/retest |
/retest |
/retest |
/test pull-kubernetes-e2e-kops-aws |
ping @sjpotter @timstclair for lgtm and approve |
/lgtm |
@k8s-bot test this Tests are more than 96 hours old. Re-running tests. |
This PR hasn't been active in 30 days. It will be closed in 59 days (Feb 6, 2018). cc @gyliu513 @sjpotter @tallclair You can add 'keep-open' label to prevent this from happening, or add a comment to keep it open another 90 days |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@gyliu513 is this still valid? |
@cblecker Yes, still valid, I will rebase the PR soon. |
The function of `validateNodeIP` is belong to kubelet_node_status, so the unit test of this function should be in node status test file.
@cblecker @tallclair the PR is updated, can you help review again? Thanks. |
I know I lgtm'd this before, but this test seems fine in kubelet_network_test. Why move it? |
@tallclair my thinking is the function of |
Right, that makes sense. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gyliu513, tallclair, timstclair The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kubernetes-e2e-kops-aws |
/retest Review the full test history for this PR. Silence the bot with an |
/retest |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
The function of
validateNodeIP
is belong to kubelet_node_status,so the unit test of this function should be in node status test file.
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: