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

Fix "Failed Pod can be replaced in group" e2e test. #3148

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion test/e2e/singlecluster/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ var _ = ginkgo.Describe("Pod groups", func() {
var p corev1.Pod
g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(rep), &p)).To(gomega.Succeed())
g.Expect(p.Spec.SchedulingGates).To(gomega.BeEmpty())
g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(group[0]), &p)).To(testing.BeNotFoundError())
}, util.Timeout, util.Interval).Should(gomega.Succeed())
expectPodFinalized(ctx, k8sClient, client.ObjectKeyFromObject(group[0]))
})

ginkgo.By("Excess pod is deleted", func() {
Expand Down Expand Up @@ -563,6 +563,20 @@ var _ = ginkgo.Describe("Pod groups", func() {
})
})

func expectPodFinalized(ctx context.Context, k8sClient client.Client, pKey client.ObjectKey) {
gomega.EventuallyWithOffset(1, func() error {
var p corev1.Pod
err := k8sClient.Get(ctx, pKey, &p)
if client.IgnoreNotFound(err) != nil {
return err
}
if err != nil || len(p.Finalizers) == 0 {
return nil
}
return fmt.Errorf("pod %s is not finalized yet", pKey)
}, util.Timeout, util.Interval).Should(gomega.Succeed())
}

func expectWorkloadFinalized(ctx context.Context, k8sClient client.Client, wlKey client.ObjectKey) {
gomega.EventuallyWithOffset(1, func() error {
var wl kueue.Workload
Expand Down