mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
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:
parent
d11a3930c0
commit
f866243e0a
@ -21,6 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/util/wait"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -30,7 +31,7 @@ import (
|
||||
var _ = Describe("kube-ui", func() {
|
||||
const (
|
||||
uiServiceName = "kube-ui"
|
||||
uiRcName = uiServiceName
|
||||
uiAppName = uiServiceName
|
||||
uiNamespace = api.NamespaceSystem
|
||||
|
||||
serverStartTimeout = 1 * time.Minute
|
||||
@ -44,7 +45,8 @@ var _ = Describe("kube-ui", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Checking to make sure the kube-ui pods are running")
|
||||
err = waitForRCPodsRunning(f.Client, uiNamespace, uiRcName)
|
||||
selector := labels.SelectorFromSet(labels.Set(map[string]string{"k8s-app": uiAppName}))
|
||||
err = waitForPodsWithLabelRunning(f.Client, uiNamespace, selector)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Checking to make sure we get a response from the kube-ui.")
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user