e2e test for kubectl exec, port-forward

This commit is contained in:
Jeff Lowdermilk
2015-06-30 09:43:37 -07:00
parent f0a36b0afd
commit 4b36b421aa
2 changed files with 103 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ package e2e
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"math"
"math/rand"
@@ -832,6 +833,20 @@ func runKubectl(args ...string) string {
return strings.TrimSpace(stdout.String())
}
func startCmdAndStreamOutput(cmd *exec.Cmd) (stdout, stderr io.ReadCloser, err error) {
stdout, err = cmd.StdoutPipe()
if err != nil {
return
}
stderr, err = cmd.StderrPipe()
if err != nil {
return
}
Logf("Asyncronously running '%s %s'", cmd.Path, strings.Join(cmd.Args, " "))
err = cmd.Start()
return
}
// testContainerOutput runs testContainerOutputInNamespace with the default namespace.
func testContainerOutput(scenarioName string, c *client.Client, pod *api.Pod, containerIndex int, expectedOutput []string) {
testContainerOutputInNamespace(scenarioName, c, pod, containerIndex, expectedOutput, api.NamespaceDefault)