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

move from daemon_restart.go to framework/util.go #45423

Merged
merged 1 commit into from
May 12, 2017

Conversation

jeffvance
Copy link
Contributor

What this PR does / why we need it:
Moves the func nodeExec from daemon_restart.go to framework/util.go. This is the correct file for this func and is a more intuitive pkg for other callers to use. This is a small step of the larger effort of restructuring e2e tests to be more logically structured and easier for newcomers to understand.

NONE

cc @timothysc @copejon

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 5, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@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 May 5, 2017
@timothysc timothysc added this to the v1.7 milestone May 5, 2017
@jeffvance
Copy link
Contributor Author

@k8s-bot test this

@jeffvance
Copy link
Contributor Author

@k8s-bot bazel test this

@@ -3835,7 +3844,7 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
host := ""
for _, a := range node.Status.Addresses {
if a.Type == v1.NodeExternalIP {
host = a.Address + ":22"
host = fmt.Sprintf("%v:%v", a.Address, sshPort)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems orthogonal to your change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. But using Sprintf vs. string addition is a more common pattern from what I've seen, and I was on that line of code. I can change it back if it matters.

@jeffvance
Copy link
Contributor Author

@liggitt @timothysc I can't discover the bazel build failure. All I see is this (each time I've re-run):
Unable to load build details from gs://kubernetes-jenkins/pr-logs/pull/45423/pull-kubernetes-bazel/16179

@ixdy
Copy link
Member

ixdy commented May 5, 2017

Issue with prow.
@k8s-bot bazel test this

@@ -101,6 +101,8 @@ import (
testutils "k8s.io/kubernetes/test/utils"
)

const sshPort = "22"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

push this down to const ( ... ) block on L106?

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2017
@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 11, 2017
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 11, 2017
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 11, 2017
@jeffvance
Copy link
Contributor Author

@K8s test this

@jeffvance
Copy link
Contributor Author

@k8s-bot unit test this

@jeffvance
Copy link
Contributor Author

@liggitt @saad-ali can I get a quick review and an approve? thanks

Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

net.JoinHostPort instead of sprintf

// NodeExec execs the given cmd on node via SSH. Note that the nodeName is an sshable name,
// eg: the name returned by framework.GetMasterHost(). This is also not guaranteed to work across
// cloud providers since it involves ssh.
func NodeExec(nodeName, cmd string) (SSHResult, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a move? I don't see it being removed from somewhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duh! Thanks. Somehow daemon_restart.go didn't get commited.

// eg: the name returned by framework.GetMasterHost(). This is also not guaranteed to work across
// cloud providers since it involves ssh.
func NodeExec(nodeName, cmd string) (SSHResult, error) {
return SSH(cmd, fmt.Sprintf("%v:%v", nodeName, sshPort), TestContext.Provider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not thrilled with exporting package functions that depend on global vars

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'm open to something better. I see this type of pattern where an exported func calls an internal func, adding args to the call. Not sure if the added args are global or not. Is this a deal breaker?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block on it, but it seems like increased surface area without a whole lot of benefit

@saad-ali
Copy link
Member

I will let @liggitt review this. Once he's happy with it 👍

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 12, 2017
@liggitt
Copy link
Member

liggitt commented May 12, 2017

go ahead and squash to a single commit, then LGTM

@jeffvance
Copy link
Contributor Author

@k8s-bot unit test this

@jeffvance
Copy link
Contributor Author

Thank you @liggitt. I need an /approve and /lgtm.

@jeffvance
Copy link
Contributor Author

@k8s-bot test this

@liggitt
Copy link
Member

liggitt commented May 12, 2017

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@liggitt
Copy link
Member

liggitt commented May 12, 2017

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeffvance, liggitt

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 May 12, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 5c23dc7 into kubernetes:master May 12, 2017
@jeffvance
Copy link
Contributor Author

@k8s-bot unit test this
@k8s-bot pull-kubernetes-federation-e2e-gce test this

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. area/test 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

9 participants