Merge pull request #132322 from nojnhuh/dra-e2e-finalizer-flake

DRA: wrap e2e finalizer update in retry
This commit is contained in:
Kubernetes Prow Robot
2025-06-15 23:10:58 -07:00
committed by GitHub

View File

@@ -1540,12 +1540,19 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), feature.Dynami
b.create(ctx, pod, template)
b.testPod(ctx, f, pod)
ginkgo.DeferCleanup(func(ctx context.Context) {
// Unblock shutdown by removing the finalizer.
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "get pod")
pod.Finalizers = nil
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(ctx, pod, metav1.UpdateOptions{})
framework.ExpectNoError(err, "remove finalizers from pod")
gomega.Eventually(ctx, func(ctx context.Context) error {
// Unblock shutdown by removing the finalizer.
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("get pod: %w", err)
}
pod.Finalizers = nil
_, err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Update(ctx, pod, metav1.UpdateOptions{})
if err != nil {
return fmt.Errorf("remove finalizers from pod: %w", err)
}
return nil
}).WithTimeout(30*time.Second).WithPolling(1*time.Second).Should(gomega.Succeed(), "Failed to remove finalizers")
})
// Now evict it.