Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e kubectl proxy test: Make future flake diagnosis possible #19968

Merged
merged 1 commit into from Jan 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/e2e/kubectl.go
Expand Up @@ -352,7 +352,9 @@ var _ = Describe("Kubectl client", func() {
}
proxyAddr := fmt.Sprintf("http://%s:8080", goproxyPod.Status.PodIP)

shellCommand := fmt.Sprintf("%s=%s .%s --kubeconfig=%s --server=%s --namespace=%s exec nginx echo running in container", proxyVar, proxyAddr, uploadBinaryName, kubecConfigRemotePath, apiServer, ns)
shellCommand := fmt.Sprintf("%s=%s .%s --kubeconfig=%s --server=%s --namespace=%s exec nginx echo running in container",
proxyVar, proxyAddr, uploadBinaryName, kubecConfigRemotePath, apiServer, ns)
Logf("About to remote exec: %v", shellCommand)
// Execute kubectl on remote exec server.
var netexecShellOutput []byte
if subResourceProxyAvailable {
Expand Down Expand Up @@ -383,6 +385,12 @@ var _ = Describe("Kubectl client", func() {
Failf("Unable to read the result from the netexec server. Error: %s", err)
}

// Get (and print!) the proxy logs here, so
// they'll be present in case the below check
// fails the test, to help diagnose #19500 if
// it recurs.
proxyLog := runKubectlOrDie("log", "goproxy", fmt.Sprintf("--namespace=%v", ns))

// Verify we got the normal output captured by the exec server
expectedExecOutput := "running in container\n"
if netexecOuput.Output != expectedExecOutput {
Expand All @@ -391,7 +399,6 @@ var _ = Describe("Kubectl client", func() {

// Verify the proxy server logs saw the connection
expectedProxyLog := fmt.Sprintf("Accepting CONNECT to %s", strings.TrimRight(strings.TrimLeft(testContext.Host, "https://"), "/api"))
proxyLog := runKubectlOrDie("log", "goproxy", fmt.Sprintf("--namespace=%v", ns))

if !strings.Contains(proxyLog, expectedProxyLog) {
Failf("Missing expected log result on proxy server for %s. Expected: %q, got %q", proxyVar, expectedProxyLog, proxyLog)
Expand Down