mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #26604 from zmerlynn/ssh-slow
Automatic merge from submit-queue SSH e2e: Limit to 100 nodes, limit combinatorics []()This limits the "for all hosts" to 100 nodes, and also limits the combinatorial section so that we only do the other SSH command variant testing on the first host rather than *all* of the hosts. I also killed one of the variants because it didn't seem to be testing much important. Fixes #26600
This commit is contained in:
commit
ea07d310d1
@ -25,6 +25,8 @@ import (
|
|||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const maxNodes = 100
|
||||||
|
|
||||||
var _ = framework.KubeDescribe("SSH", func() {
|
var _ = framework.KubeDescribe("SSH", func() {
|
||||||
|
|
||||||
f := framework.NewDefaultFramework("ssh")
|
f := framework.NewDefaultFramework("ssh")
|
||||||
@ -50,17 +52,27 @@ var _ = framework.KubeDescribe("SSH", func() {
|
|||||||
expectedCode int
|
expectedCode int
|
||||||
expectedError error
|
expectedError error
|
||||||
}{
|
}{
|
||||||
{`echo "Hello"`, true, "Hello", "", 0, nil},
|
// Keep this test first - this variant runs on all nodes.
|
||||||
// Same as previous, but useful for test output diagnostics.
|
|
||||||
{`echo "Hello from $(whoami)@$(hostname)"`, false, "", "", 0, nil},
|
{`echo "Hello from $(whoami)@$(hostname)"`, false, "", "", 0, nil},
|
||||||
{`echo "foo" | grep "bar"`, true, "", "", 1, nil},
|
{`echo "foo" | grep "bar"`, true, "", "", 1, nil},
|
||||||
{`echo "Out" && echo "Error" >&2 && exit 7`, true, "Out", "Error", 7, nil},
|
{`echo "Out" && echo "Error" >&2 && exit 7`, true, "Out", "Error", 7, nil},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run commands on all nodes via SSH.
|
for i, testCase := range testCases {
|
||||||
for _, testCase := range testCases {
|
// Only run the first testcase against max 100 nodes. Run
|
||||||
By(fmt.Sprintf("SSH'ing to all nodes and running %s", testCase.cmd))
|
// the rest against the first node we find only, since
|
||||||
for _, host := range hosts {
|
// they're basically testing SSH semantics (and we don't
|
||||||
|
// need to do that against each host in the cluster).
|
||||||
|
nodes := len(hosts)
|
||||||
|
if i > 0 {
|
||||||
|
nodes = 1
|
||||||
|
} else if nodes > maxNodes {
|
||||||
|
nodes = maxNodes
|
||||||
|
}
|
||||||
|
testhosts := hosts[:nodes]
|
||||||
|
By(fmt.Sprintf("SSH'ing to %d nodes and running %s", len(testhosts), testCase.cmd))
|
||||||
|
|
||||||
|
for _, host := range testhosts {
|
||||||
result, err := framework.SSH(testCase.cmd, host, framework.TestContext.Provider)
|
result, err := framework.SSH(testCase.cmd, host, framework.TestContext.Provider)
|
||||||
stdout, stderr := strings.TrimSpace(result.Stdout), strings.TrimSpace(result.Stderr)
|
stdout, stderr := strings.TrimSpace(result.Stdout), strings.TrimSpace(result.Stderr)
|
||||||
if err != testCase.expectedError {
|
if err != testCase.expectedError {
|
||||||
|
Loading…
Reference in New Issue
Block a user