mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
portforwarding e2e: print logs when pod doesn't terminate
This commit is contained in:
parent
878c8d41f1
commit
ff142b2823
@ -180,9 +180,7 @@ var _ = framework.KubeDescribe("Port forwarding", func() {
|
|||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
||||||
By("Waiting for the target pod to stop running")
|
By("Waiting for the target pod to stop running")
|
||||||
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
|
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
|
||||||
framework.Failf("Pod did not stop running: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
By("Retrieving logs from the target pod")
|
By("Retrieving logs from the target pod")
|
||||||
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
|
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)
|
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")
|
By("Verifying logs")
|
||||||
verifyLogMessage(logOutput, "Accepted client connection")
|
verifyLogMessage(logOutput, "Accepted client connection")
|
||||||
verifyLogMessage(logOutput, "Expected to read 3 bytes from client, but got 0 instead")
|
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")
|
By("Waiting for the target pod to stop running")
|
||||||
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
|
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
|
||||||
framework.Failf("Pod did not stop running: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
By("Retrieving logs from the target pod")
|
By("Retrieving logs from the target pod")
|
||||||
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
|
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)
|
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")
|
By("Verifying logs")
|
||||||
verifyLogMessage(logOutput, "^Accepted client connection$")
|
verifyLogMessage(logOutput, "^Accepted client connection$")
|
||||||
verifyLogMessage(logOutput, "^Received expected client data$")
|
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")
|
By("Waiting for the target pod to stop running")
|
||||||
if err := f.WaitForPodNoLongerRunning(pod.Name); err != nil {
|
waitErr := f.WaitForPodNoLongerRunning(pod.Name)
|
||||||
framework.Failf("Pod did not stop running: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
By("Retrieving logs from the target pod")
|
By("Retrieving logs from the target pod")
|
||||||
logOutput, err := framework.GetPodLogs(f.Client, f.Namespace.Name, pod.Name, "portforwardtester")
|
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)
|
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")
|
By("Verifying logs")
|
||||||
verifyLogMessage(logOutput, "Accepted client connection")
|
verifyLogMessage(logOutput, "Accepted client connection")
|
||||||
verifyLogMessage(logOutput, "Done")
|
verifyLogMessage(logOutput, "Done")
|
||||||
|
Loading…
Reference in New Issue
Block a user