Skip to content

Commit 7255e63

Browse files
(ci) - fix cleanup to allow tests broken for 1.33 work
1 parent 012e741 commit 7255e63

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

test/e2e/v4/plugin_cluster_test.go

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ var _ = Describe("kubebuilder", func() {
6363
By("clean up API objects created during the test")
6464
_ = kbc.Make("undeploy")
6565

66+
By("clean up API objects created during the test")
67+
_ = kbc.Make("uninstall")
68+
6669
By("removing controller image and working dir")
6770
kbc.Destroy()
6871
})
@@ -88,25 +91,19 @@ var _ = Describe("kubebuilder", func() {
8891
GenerateV4WithoutMetrics(kbc)
8992
Run(kbc, true, false, false, false, false)
9093
})
91-
// FIXME: This test is currently disabled because it requires to be fixed:
92-
// https://github.com/kubernetes-sigs/kubebuilder/issues/4853
93-
// It is not working for k8s 1.33
94-
// It("should generate a runnable project with metrics protected by network policies", func() {
95-
// GenerateV4WithNetworkPoliciesWithoutWebhooks(kbc)
96-
// Run(kbc, false, false, false, true, true)
97-
// })
94+
It("should generate a runnable project with the manager running "+
95+
"as restricted and without webhooks", func() {
96+
GenerateV4WithoutWebhooks(kbc)
97+
Run(kbc, false, false, false, true, false)
98+
})
99+
//It("should generate a runnable project with metrics protected by network policies", func() {
100+
// GenerateV4WithNetworkPoliciesWithoutWebhooks(kbc)
101+
// Run(kbc, false, false, false, true, true)
102+
//})
98103
It("should generate a runnable project with webhooks and metrics protected by network policies", func() {
99104
GenerateV4WithNetworkPolicies(kbc)
100105
Run(kbc, true, false, false, true, true)
101106
})
102-
// FIXME: This test is currently disabled because it requires to be fixed:
103-
// https://github.com/kubernetes-sigs/kubebuilder/issues/4853
104-
// It is not working for k8s 1.33
105-
// It("should generate a runnable project with the manager running "+
106-
// "as restricted and without webhooks", func() {
107-
// GenerateV4WithoutWebhooks(kbc)
108-
// Run(kbc, false, false, false, true, false)
109-
// })
110107
})
111108
})
112109

@@ -615,8 +612,26 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
615612

616613
func removeCurlPod(kbc *utils.TestContext) {
617614
By("cleaning up the curl pod")
618-
_, err := kbc.Kubectl.Delete(true, "pods/curl")
619-
Expect(err).NotTo(HaveOccurred())
615+
616+
_, err := kbc.Kubectl.Delete(true, "pod", "curl")
617+
Expect(err).NotTo(HaveOccurred(), "Failed to delete curl pod")
618+
619+
var deleted bool
620+
Eventually(func() bool {
621+
_, err := kbc.Kubectl.Get(true, "pod", "curl")
622+
deleted = err != nil
623+
return deleted
624+
}, time.Minute, time.Second).Should(BeTrue(), "curl pod should be deleted within 1 minute")
625+
626+
if !deleted {
627+
By("forcing deletion of the curl pod")
628+
_, err := kbc.Kubectl.Command("delete", "pod", "curl", "--grace-period=0", "--force")
629+
Expect(err).NotTo(HaveOccurred(), "Force delete of curl pod failed")
630+
Eventually(func(g Gomega) {
631+
_, err := kbc.Kubectl.Get(true, "pod", "curl")
632+
g.Expect(err).To(HaveOccurred())
633+
}, time.Minute, time.Second).Should(Succeed(), "curl pod should be deleted after force")
634+
}
620635
}
621636

622637
// serviceAccountToken provides a helper function that can provide you with a service account

0 commit comments

Comments
 (0)