Merge pull request #75923 from SataQiu/fix-golint-ssh-size-20190331

Fix golint failures of e2e/framework/ssh.go, e2e/framework/size.go
This commit is contained in:
Kubernetes Prow Robot 2019-03-31 05:44:32 -07:00 committed by GitHub
commit d0c0883a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,7 @@ const (
resizeNodeNotReadyTimeout = 2 * time.Minute
)
// ResizeGroup resizes an instance group
func ResizeGroup(group string, size int32) error {
if TestContext.ReportDir != "" {
CoreDump(TestContext.ReportDir)
@ -34,14 +35,17 @@ func ResizeGroup(group string, size int32) error {
return TestContext.CloudConfig.Provider.ResizeGroup(group, size)
}
// GetGroupNodes returns a node name for the specified node group
func GetGroupNodes(group string) ([]string, error) {
return TestContext.CloudConfig.Provider.GetGroupNodes(group)
}
// GroupSize returns the size of an instance group
func GroupSize(group string) (int, error) {
return TestContext.CloudConfig.Provider.GroupSize(group)
}
// WaitForGroupSize waits for node instance group reached the desired size
func WaitForGroupSize(group string, size int32) error {
timeout := 30 * time.Minute
for start := time.Now(); time.Since(start) < timeout; time.Sleep(20 * time.Second) {

View File

@ -111,6 +111,7 @@ func NodeSSHHosts(c clientset.Interface) ([]string, error) {
return sshHosts, nil
}
// SSHResult holds the execution result of SSH command
type SSHResult struct {
User string
Host string
@ -230,6 +231,7 @@ func RunSSHCommandViaBastion(cmd, user, bastion, host string, signer ssh.Signer)
return bout.String(), berr.String(), code, err
}
// LogSSHResult records SSHResult log
func LogSSHResult(result SSHResult) {
remote := fmt.Sprintf("%s@%s", result.User, result.Host)
Logf("ssh %s: command: %s", remote, result.Cmd)
@ -238,6 +240,7 @@ func LogSSHResult(result SSHResult) {
Logf("ssh %s: exit code: %d", remote, result.Code)
}
// IssueSSHCommandWithResult tries to execute a SSH command and returns the execution result
func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult, error) {
Logf("Getting external IP address for %s", node.Name)
host := ""
@ -274,6 +277,7 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
return &result, nil
}
// IssueSSHCommand tries to execute a SSH command
func IssueSSHCommand(cmd, provider string, node *v1.Node) error {
_, err := IssueSSHCommandWithResult(cmd, provider, node)
if err != nil {