clean up test code
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
@@ -47,7 +46,7 @@ var _ = SIGDescribe("SSH", func() {
|
||||
ginkgo.By("Getting all nodes' SSH-able IP addresses")
|
||||
hosts, err := e2essh.NodeSSHHosts(f.ClientSet)
|
||||
if err != nil {
|
||||
e2elog.Failf("Error getting node hostnames: %v", err)
|
||||
framework.Failf("Error getting node hostnames: %v", err)
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
@@ -82,23 +81,23 @@ var _ = SIGDescribe("SSH", func() {
|
||||
result, err := e2essh.SSH(testCase.cmd, host, framework.TestContext.Provider)
|
||||
stdout, stderr := strings.TrimSpace(result.Stdout), strings.TrimSpace(result.Stderr)
|
||||
if err != testCase.expectedError {
|
||||
e2elog.Failf("Ran %s on %s, got error %v, expected %v", testCase.cmd, host, err, testCase.expectedError)
|
||||
framework.Failf("Ran %s on %s, got error %v, expected %v", testCase.cmd, host, err, testCase.expectedError)
|
||||
}
|
||||
if testCase.checkStdout && stdout != testCase.expectedStdout {
|
||||
e2elog.Failf("Ran %s on %s, got stdout '%s', expected '%s'", testCase.cmd, host, stdout, testCase.expectedStdout)
|
||||
framework.Failf("Ran %s on %s, got stdout '%s', expected '%s'", testCase.cmd, host, stdout, testCase.expectedStdout)
|
||||
}
|
||||
if stderr != testCase.expectedStderr {
|
||||
e2elog.Failf("Ran %s on %s, got stderr '%s', expected '%s'", testCase.cmd, host, stderr, testCase.expectedStderr)
|
||||
framework.Failf("Ran %s on %s, got stderr '%s', expected '%s'", testCase.cmd, host, stderr, testCase.expectedStderr)
|
||||
}
|
||||
if result.Code != testCase.expectedCode {
|
||||
e2elog.Failf("Ran %s on %s, got exit code %d, expected %d", testCase.cmd, host, result.Code, testCase.expectedCode)
|
||||
framework.Failf("Ran %s on %s, got exit code %d, expected %d", testCase.cmd, host, result.Code, testCase.expectedCode)
|
||||
}
|
||||
// Show stdout, stderr for logging purposes.
|
||||
if len(stdout) > 0 {
|
||||
e2elog.Logf("Got stdout from %s: %s", host, strings.TrimSpace(stdout))
|
||||
framework.Logf("Got stdout from %s: %s", host, strings.TrimSpace(stdout))
|
||||
}
|
||||
if len(stderr) > 0 {
|
||||
e2elog.Logf("Got stderr from %s: %s", host, strings.TrimSpace(stderr))
|
||||
framework.Logf("Got stderr from %s: %s", host, strings.TrimSpace(stderr))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,7 +105,7 @@ var _ = SIGDescribe("SSH", func() {
|
||||
// Quickly test that SSH itself errors correctly.
|
||||
ginkgo.By("SSH'ing to a nonexistent host")
|
||||
if _, err = e2essh.SSH(`echo "hello"`, "i.do.not.exist", framework.TestContext.Provider); err == nil {
|
||||
e2elog.Failf("Expected error trying to SSH to nonexistent host.")
|
||||
framework.Failf("Expected error trying to SSH to nonexistent host.")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user