diff --git a/test/e2e/scheduler_predicates.go b/test/e2e/scheduler_predicates.go index ca0bf81101..d479139593 100644 --- a/test/e2e/scheduler_predicates.go +++ b/test/e2e/scheduler_predicates.go @@ -132,6 +132,14 @@ func waitForStableCluster(c *client.Client) int { allPods, err := c.Pods(api.NamespaceAll).List(api.ListOptions{}) framework.ExpectNoError(err) + // API server returns also Pods that succeeded. We need to filter them out. + currentPods := make([]api.Pod, 0, len(allPods.Items)) + for _, pod := range allPods.Items { + if pod.Status.Phase != api.PodSucceeded && pod.Status.Phase != api.PodFailed { + currentPods = append(currentPods, pod) + } + } + allPods.Items = currentPods scheduledPods, currentlyNotScheduledPods := getPodsScheduled(allPods) for len(currentlyNotScheduledPods) != 0 { time.Sleep(2 * time.Second)