mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
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:
commit
c71fd7b1ae
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user