Commit c71fd7b1 authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

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.
parents 38a1fb2b ff142b28
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment