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

Extract validateNodeIP test to node status test file. #46903

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

gyliu513
Copy link
Contributor

@gyliu513 gyliu513 commented Jun 3, 2017

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:

none

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 3, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Jun 3, 2017
@gyliu513
Copy link
Contributor Author

gyliu513 commented Jun 3, 2017

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jun 3, 2017
@gyliu513
Copy link
Contributor Author

gyliu513 commented Jun 5, 2017

Related to #40780

@@ -976,7 +976,6 @@ func (kl *Kubelet) validateNodeIP() error {
var ip net.IP
switch v := addr.(type) {
case *net.IPNet:
ip = v.IP

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?

Copy link
Contributor Author

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",
},

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.

Copy link
Contributor Author

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?

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.

Copy link
Contributor Author

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

@gyliu513
Copy link
Contributor Author

/retest

1 similar comment
@gyliu513
Copy link
Contributor Author

/retest

@timstclair
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 29, 2017
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2017
@gyliu513
Copy link
Contributor Author

gyliu513 commented Jul 9, 2017

/retest

4 similar comments
@gyliu513
Copy link
Contributor Author

/retest

@gyliu513
Copy link
Contributor Author

/retest

@gyliu513
Copy link
Contributor Author

/retest

@gyliu513
Copy link
Contributor Author

/retest

@fejta
Copy link
Contributor

fejta commented Jul 11, 2017

/test pull-kubernetes-e2e-kops-aws

@gyliu513
Copy link
Contributor Author

ping @sjpotter @timstclair for lgtm and approve

@tallclair tallclair assigned tallclair and unassigned timstclair Jul 12, 2017
@tallclair
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2017
@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 96 hours old. Re-running tests.

@k8s-github-robot
Copy link

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

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 9, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 8, 2018
@cblecker
Copy link
Member

cblecker commented Apr 8, 2018

@gyliu513 is this still valid?

@gyliu513
Copy link
Contributor Author

gyliu513 commented Apr 9, 2018

@cblecker Yes, still valid, I will rebase the PR soon.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 9, 2018
@kubernetes kubernetes deleted a comment from k8s-github-robot Apr 9, 2018
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2018
The function of `validateNodeIP` is belong to kubelet_node_status,
so the unit test of this function should be in node status test file.
@gyliu513
Copy link
Contributor Author

gyliu513 commented Apr 9, 2018

@cblecker @tallclair the PR is updated, can you help review again? Thanks.

@tallclair
Copy link
Member

I know I lgtm'd this before, but this test seems fine in kubelet_network_test. Why move it?

@gyliu513
Copy link
Contributor Author

@tallclair my thinking is the function of validateNodeIP is belong to kubelet_node_status, so the unit test of this function should be in node status test file as well.

@tallclair
Copy link
Member

Right, that makes sense.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 11, 2018
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gyliu513
Copy link
Contributor Author

/test pull-kubernetes-e2e-kops-aws

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@gyliu513
Copy link
Contributor Author

/retest

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit cc9f1a5 into kubernetes:master Apr 11, 2018
@gyliu513 gyliu513 deleted the validateip branch April 12, 2018 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants