From 81a6cf284783dba51db495a65ca1338e2a829b11 Mon Sep 17 00:00:00 2001 From: Morten Torkildsen Date: Tue, 17 Dec 2019 12:45:42 -0800 Subject: [PATCH] Change PDB tests to use pod conditions instead of phase --- test/e2e/apps/disruption.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/e2e/apps/disruption.go b/test/e2e/apps/disruption.go index 985e255660a..98ec2338abc 100644 --- a/test/e2e/apps/disruption.go +++ b/test/e2e/apps/disruption.go @@ -31,6 +31,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" "k8s.io/client-go/util/retry" + podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/test/e2e/framework" imageutils "k8s.io/kubernetes/test/utils/image" ) @@ -314,8 +315,9 @@ func waitForPodsOrDie(cs kubernetes.Interface, ns string, n int) { return false, nil } ready := 0 - for i := 0; i < n; i++ { - if pods.Items[i].Status.Phase == v1.PodRunning { + for i := range pods.Items { + pod := pods.Items[i] + if podutil.IsPodReady(&pod) { ready++ } } @@ -373,8 +375,9 @@ func locateRunningPod(cs kubernetes.Interface, ns string) (pod *v1.Pod, err erro } for i := range podList.Items { - if podList.Items[i].Status.Phase == v1.PodRunning { - pod = &podList.Items[i] + p := podList.Items[i] + if podutil.IsPodReady(&p) { + pod = &p return true, nil } }