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

add tests for managed hosts file content #44572

Conversation

evie404
Copy link
Contributor

@evie404 evie404 commented Apr 17, 2017

What this PR does / why we need it: a tiny refactor to separate concerns host file content from the logic ensuring that the file exists, and also adds unit test.

This is to prepare extending the host file logic to include customized entries described in #43632. I'm wary of changing that logic in absence of any unit tests.

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 Apr 17, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @rickypai. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 17, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Apr 17, 2017
@cblecker
Copy link
Member

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 18, 2017
@evie404
Copy link
Contributor Author

evie404 commented Apr 18, 2017

my bad. i only ran the unit tests but forgot to run gofmt. let me update this.

@evie404 evie404 force-pushed the rpai/tests_for_managed_etc_hosts_content branch 2 times, most recently from d9308d4 to 56ca3ef Compare April 18, 2017 23:34
@evie404
Copy link
Contributor Author

evie404 commented Apr 24, 2017

hi, can I get some eyes on this? It's a small change that adds test and will help with further improvements in this particular section of the kubelet code :)

@cblecker
Copy link
Member

@rickypai would you mind squashing your commits?

add tests to assert the output of `ensureHostsFile`
@evie404 evie404 force-pushed the rpai/tests_for_managed_etc_hosts_content branch from 56ca3ef to e21da83 Compare April 24, 2017 19:34
@evie404
Copy link
Contributor Author

evie404 commented Apr 24, 2017

no problem. squash-rebased

@derekwaynecarr
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2017
@cblecker
Copy link
Member

munger didn't seem to pick up the label. commenting to try and kick it

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: derekwaynecarr, rickypai

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 24, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 44741, 44853, 44572, 44797, 44439)

@k8s-github-robot k8s-github-robot merged commit 9dde8ec into kubernetes:master Apr 25, 2017
@evie404 evie404 deleted the rpai/tests_for_managed_etc_hosts_content branch April 25, 2017 17:43
k8s-github-robot pushed a commit that referenced this pull request May 1, 2017
Automatic merge from submit-queue (batch tested with PRs 45110, 45148)

write HostAliases to hosts file

**What this PR does / why we need it**: using the PodSpec's `HostAliases`, we write entries into the Kubernetes-managed hosts file.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #43632

**Special notes for your reviewer**:
Previous PRs in this series:
- #44572 isolates the logic of creating the file and writing the file
- #44641 introduces the `HostAliases` field in PodSpec along with validations

**Release note**:
```release-note
PodSpec's `HostAliases` now write entries into the Kubernetes-managed hosts file.
```

@thockin @yujuhong 

Thanks for reviewing!
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. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants