Skip to content

Commit edb39d7

Browse files
authored
Merge pull request kubernetes#121583 from bzsuni/fix/e2e/apimachinery
Fix the e2e bug related to the Garbage collector in api-machinery
2 parents c3eebb2 + b2c7431 commit edb39d7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/e2e/apimachinery/garbage_collector.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,14 +1101,11 @@ var _ = SIGDescribe("Garbage collector", func() {
11011101
framework.Failf("timeout in waiting for the owner to be deleted: %v", err)
11021102
}
11031103

1104-
// Wait 30s and ensure the dependent is not deleted.
1105-
ginkgo.By("wait for 30 seconds to see if the garbage collector mistakenly deletes the dependent crd")
1106-
if err := wait.PollWithContext(ctx, 5*time.Second, 30*time.Second+gcInformerResyncRetryTimeout, func(ctx context.Context) (bool, error) {
1107-
_, err := resourceClient.Get(ctx, dependentName, metav1.GetOptions{})
1108-
return false, err
1109-
}); err != nil && !wait.Interrupted(err) {
1110-
framework.Failf("failed to ensure the dependent is not deleted: %v", err)
1111-
}
1104+
timeout := 30*time.Second + gcInformerResyncRetryTimeout
1105+
ginkgo.By(fmt.Sprintf("wait for %s to see if the garbage collector mistakenly deletes the dependent crd\n", timeout))
1106+
gomega.Consistently(ctx, framework.HandleRetry(func(ctx context.Context) (*unstructured.Unstructured, error) {
1107+
return resourceClient.Get(ctx, dependentName, metav1.GetOptions{})
1108+
})).WithTimeout(timeout).WithPolling(5 * time.Second).ShouldNot(gomega.BeNil())
11121109
})
11131110

11141111
ginkgo.It("should delete jobs and pods created by cronjob", func(ctx context.Context) {

0 commit comments

Comments
 (0)