portforwarding e2e: print logs when pod doesn't terminate

pull/6/head
Dr. Stefan Schimanski 2016-06-08 10:22:33 +02:00
parent 878c8d41f1
commit ff142b2823
1 changed files with 18 additions and 9 deletions

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")