mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
e2e pod: dump pod in unexpected phase
When stopping polling, the provided messages becomes the complete failure message. This means that the code which calls gomega.StopTrying must include the pod in the message instead of just summarizing the phase. This makes the failure more useful.
This commit is contained in:
parent
0a162a9cd2
commit
aa772d77fb
@ -75,7 +75,7 @@ func BeRunningNoRetries() types.GomegaMatcher {
|
||||
gcustom.MakeMatcher(func(pod *v1.Pod) (bool, error) {
|
||||
switch pod.Status.Phase {
|
||||
case v1.PodFailed, v1.PodSucceeded:
|
||||
return false, gomega.StopTrying(fmt.Sprintf("Expected pod to reach phase %q, got final phase %q instead.", v1.PodRunning, pod.Status.Phase))
|
||||
return false, gomega.StopTrying(fmt.Sprintf("Expected pod to reach phase %q, got final phase %q instead:\n%s", v1.PodRunning, pod.Status.Phase, format.Object(pod, 1)))
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
|
@ -366,7 +366,16 @@ In [It] at: wait_test.go:71 <time>
|
||||
Status: "failed",
|
||||
Failure: &reporters.JUnitFailure{
|
||||
Description: `[FAILED] Told to stop trying after <after>.
|
||||
Expected pod to reach phase "Running", got final phase "Failed" instead.
|
||||
Expected pod to reach phase "Running", got final phase "Failed" instead:
|
||||
<*v1.Pod>:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: failed-pod
|
||||
namespace: default
|
||||
spec:
|
||||
containers: null
|
||||
status:
|
||||
phase: Failed
|
||||
In [It] at: wait_test.go:75 <time>
|
||||
`,
|
||||
Type: "failed",
|
||||
@ -378,7 +387,16 @@ In [It] at: wait_test.go:75 <time>
|
||||
k8s.io/kubernetes/test/e2e/framework/pod_test.glob..func1.6()
|
||||
wait_test.go:75
|
||||
[FAILED] Told to stop trying after <after>.
|
||||
Expected pod to reach phase "Running", got final phase "Failed" instead.
|
||||
Expected pod to reach phase "Running", got final phase "Failed" instead:
|
||||
<*v1.Pod>:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: failed-pod
|
||||
namespace: default
|
||||
spec:
|
||||
containers: null
|
||||
status:
|
||||
phase: Failed
|
||||
In [It] at: wait_test.go:75 <time>
|
||||
< Exit [It] failed - wait_test.go:74 <time>
|
||||
`,
|
||||
|
Loading…
Reference in New Issue
Block a user