Merge pull request #86366 from mortent/DeflakePDBTest

Change PDB tests to use pod conditions instead of phase
This commit is contained in:
Kubernetes Prow Robot 2020-01-08 19:11:39 -08:00 committed by GitHub
commit 61cf95f2a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}