Fix kube-ui e2e test waiting for the rc pods

Kube-ui pods do not have the {"name":rcName} label like pods created in
e2e tests. Hence, we cannot use the waitForRCPods function directly, but
have to pass a custom label.
This commit is contained in:
Dr. Stefan Schimanski
2015-10-18 14:16:52 +01:00
parent d11a3930c0
commit f866243e0a
2 changed files with 18 additions and 5 deletions

View File

@@ -1524,10 +1524,21 @@ func ScaleRC(c *client.Client, ns, name string, size uint, wait bool) error {
return waitForRCPodsRunning(c, ns, name)
}
// Wait up to 10 minutes for pods to become Running.
// Wait up to 10 minutes for pods to become Running. Assume that the pods of the
// rc are labels with {"name":rcName}.
func waitForRCPodsRunning(c *client.Client, ns, rcName string) error {
selector := labels.SelectorFromSet(labels.Set(map[string]string{"name": rcName}))
err := waitForPodsWithLabelRunning(c, ns, selector)
if err != nil {
return fmt.Errorf("Error while waiting for replication controller %s pods to be running: %v", rcName, err)
}
return nil
}
// Wait up to 10 minutes for all matching pods to become Running and at least one
// matching pod exists.
func waitForPodsWithLabelRunning(c *client.Client, ns string, label labels.Selector) error {
running := false
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": rcName}))
podStore := newPodStore(c, ns, label, fields.Everything())
defer podStore.Stop()
waitLoop:
@@ -1545,7 +1556,7 @@ waitLoop:
break
}
if !running {
return fmt.Errorf("Timeout while waiting for replication controller %s pods to be running", rcName)
return fmt.Errorf("Timeout while waiting for pods with labels %q to be running", label.String())
}
return nil
}