Merge pull request #27031 from sttts/sttts-flake-26955-pod-logs

Automatic merge from submit-queue

Flake 26955: portforwarding e2e: print logs when pod doesn't terminate

For more insights why flake #26955 happens.
This commit is contained in:
k8s-merge-robot 2016-06-10 03:24:36 -07:00 committed by GitHub
commit c71fd7b1ae

View File

@ -180,9 +180,7 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
conn.Close()
By("Waiting for the target pod to stop running")
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
framework.Failf("Pod did not stop running: %v", err)
}
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
By("Retrieving logs from the target pod")
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
@ -190,6 +188,11 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
framework.Failf("Error retrieving logs: %v", err)
}
if waitErr != nil {
framework.Logf("Pod log:\n%s", logOutput)
framework.Failf("Pod did not stop running: %v", waitErr)
}
By("Verifying logs")
verifyLogMessage(logOutput, "Accepted client connection")
verifyLogMessage(logOutput, "Expected to read 3 bytes from client, but got 0 instead")
@ -240,9 +243,7 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
}
By("Waiting for the target pod to stop running")
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
framework.Failf("Pod did not stop running: %v", err)
}
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
By("Retrieving logs from the target pod")
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
@ -250,6 +251,11 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
framework.Failf("Error retrieving logs: %v", err)
}
if waitErr != nil {
framework.Logf("Pod log:\n%s", logOutput)
framework.Failf("Pod did not stop running: %v", waitErr)
}
By("Verifying logs")
verifyLogMessage(logOutput, "^Accepted client connection$")
verifyLogMessage(logOutput, "^Received expected client data$")
@ -292,9 +298,7 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
}
By("Waiting for the target pod to stop running")
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
framework.Failf("Pod did not stop running: %v", err)
}
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
By("Retrieving logs from the target pod")
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
@ -302,6 +306,11 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
framework.Failf("Error retrieving logs: %v", err)
}
if waitErr != nil {
framework.Logf("Pod log:\n%s", logOutput)
framework.Failf("Pod did not stop running: %v", waitErr)
}
By("Verifying logs")
verifyLogMessage(logOutput, "Accepted client connection")
verifyLogMessage(logOutput, "Done")