Move framework ssh code to new package

The framework/ssh.go code was heavily used throughout the framework
and could be useful elsewhere but reusing those methods requires
importing all of the framework.

Extracting these methods to their own package for reuse.

Only a few methods had to be copied into this package from the
rest of the framework to avoid an import cycle.
This commit is contained in:
John Schnake
2019-05-01 11:53:13 -05:00
parent 22b6c69983
commit 338bc3ce42
32 changed files with 259 additions and 119 deletions

View File

@@ -20,6 +20,8 @@ import (
"bufio"
"fmt"
"strings"
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
)
// KubemarkResourceUsage is a struct for tracking the resource usage of kubemark.
@@ -30,7 +32,7 @@ type KubemarkResourceUsage struct {
}
func getMasterUsageByPrefix(prefix string) (string, error) {
sshResult, err := SSH(fmt.Sprintf("ps ax -o %%cpu,rss,command | tail -n +2 | grep %v | sed 's/\\s+/ /g'", prefix), GetMasterHost()+":22", TestContext.Provider)
sshResult, err := e2essh.SSH(fmt.Sprintf("ps ax -o %%cpu,rss,command | tail -n +2 | grep %v | sed 's/\\s+/ /g'", prefix), GetMasterHost()+":22", TestContext.Provider)
if err != nil {
return "", err
}