Parallel waiting for pods in e2e

This commit is contained in:
Sylwester Brzeczkowski 2016-06-09 12:14:46 +02:00
parent 07471cf90f
commit 5561056d74

View File

@ -1599,13 +1599,21 @@ func podsRunning(c *client.Client, pods *api.PodList) []error {
// are running so non-running pods cause a timeout for this test.
By("ensuring each pod is running")
e := []error{}
error_chan := make(chan error)
for _, pod := range pods.Items {
// TODO: make waiting parallel.
err := WaitForPodRunningInNamespace(c, pod.Name, pod.Namespace)
go func(p api.Pod) {
error_chan <- WaitForPodRunningInNamespace(c, p.Name, p.Namespace)
}(pod)
}
for range pods.Items {
err := <-error_chan
if err != nil {
e = append(e, err)
}
}
return e
}