Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for RSes to be cleared after calling RS Reaper #32825

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions test/e2e/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ func stopDeployment(c *clientset.Clientset, oldC client.Interface, ns, deploymen
selector, err := unversioned.LabelSelectorAsSelector(deployment.Spec.Selector)
Expect(err).NotTo(HaveOccurred())
options := api.ListOptions{LabelSelector: selector}
rss, err := c.Extensions().ReplicaSets(ns).List(options)
// NOTE: this is cherrypicked to 1.2 only to fix the kubernetes-e2e-gke-1.2-1.4-upgrade-cluster test flakes
err = waitForReplicaSetsGone(c, ns, options)
Expect(err).NotTo(HaveOccurred())
Expect(rss.Items).Should(HaveLen(0))
Logf("ensuring deployment %s pods were deleted", deploymentName)
var pods *api.PodList
if err := wait.PollImmediate(time.Second, wait.ForeverTestTimeout, func() (bool, error) {
Expand All @@ -207,6 +207,21 @@ func stopDeployment(c *clientset.Clientset, oldC client.Interface, ns, deploymen
}
}

// NOTE: this is cherrypicked to 1.2 only to fix the kubernetes-e2e-gke-1.2-1.4-upgrade-cluster test flakes
func waitForReplicaSetsGone(c *clientset.Clientset, ns string, options api.ListOptions) error {
return wait.Poll(poll, wait.ForeverTestTimeout, func() (bool, error) {
rss, err := c.Extensions().ReplicaSets(ns).List(options)
if err != nil {
return false, err
}
if len(rss.Items) != 0 {
Logf("Waiting for all RSes to be gone, %d RS left", len(rss.Items))
return false, nil
}
return true, nil
})
}

func testNewDeployment(f *Framework) {
ns := f.Namespace.Name
// TODO: remove unversionedClient when the refactoring is done. Currently some
Expand Down