mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Speed up DeleteRC test util func
This commit is contained in:
parent
a914bbd0b8
commit
ef0953585e
@ -2319,10 +2319,12 @@ func DeleteRC(c *client.Client, ns, name string) error {
|
|||||||
// waitForRCPodsGone waits until there are no pods reported under an RC's selector (because the pods
|
// waitForRCPodsGone waits until there are no pods reported under an RC's selector (because the pods
|
||||||
// have completed termination).
|
// have completed termination).
|
||||||
func waitForRCPodsGone(c *client.Client, rc *api.ReplicationController) error {
|
func waitForRCPodsGone(c *client.Client, rc *api.ReplicationController) error {
|
||||||
|
labels := labels.SelectorFromSet(rc.Spec.Selector)
|
||||||
|
podStore := newPodStore(c, rc.Namespace, labels, fields.Everything())
|
||||||
|
defer podStore.Stop()
|
||||||
|
|
||||||
return wait.PollImmediate(poll, 2*time.Minute, func() (bool, error) {
|
return wait.PollImmediate(poll, 2*time.Minute, func() (bool, error) {
|
||||||
selector := labels.SelectorFromSet(rc.Spec.Selector)
|
if pods := podStore.List(); len(pods) == 0 {
|
||||||
options := api.ListOptions{LabelSelector: selector}
|
|
||||||
if pods, err := c.Pods(rc.Namespace).List(options); err == nil && len(pods.Items) == 0 {
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user