Skip to content

Commit

Permalink
Merge pull request #87471 from lavalamp/you-must-wait
Browse files Browse the repository at this point in the history
don't wait blindly
  • Loading branch information
k8s-ci-robot committed Jan 23, 2020
2 parents 4630690 + e8c20e1 commit 50fa183
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/e2e/apimachinery/garbage_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,18 @@ var _ = SIGDescribe("Garbage collector", func() {
if err := deployClient.Delete(deployment.ObjectMeta.Name, deleteOptions); err != nil {
framework.Failf("failed to delete the deployment: %v", err)
}
ginkgo.By("wait for 30 seconds to see if the garbage collector mistakenly deletes the rs")
time.Sleep(30 * time.Second)
ginkgo.By("wait for deployment deletion to see if the garbage collector mistakenly deletes the rs")
err = wait.PollImmediate(500*time.Millisecond, 1*time.Minute, func() (bool, error) {
dList, err := deployClient.List(metav1.ListOptions{})
if err != nil {
return false, fmt.Errorf("failed to list deployments: %v", err)
}
return len(dList.Items) == 0, nil
})
if err != nil {
framework.Failf("Failed to wait for the Deployment to be deleted: %v", err)
}
// Once the deployment object is gone, we'll know the GC has finished performing any relevant actions.
objects := map[string]int{"Deployments": 0, "ReplicaSets": 1, "Pods": 2}
ok, err := verifyRemainingObjects(f, objects)
if err != nil {
Expand Down

0 comments on commit 50fa183

Please sign in to comment.