Skip to content

Commit 3325100

Browse files
(ci) - fix cleanup to allow tests broken for 1.33 work
1 parent 0c3b376 commit 3325100

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/e2e/v4/plugin_cluster_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ var _ = Describe("kubebuilder", func() {
5757
})
5858

5959
AfterEach(func() {
60-
By("By removing restricted namespace label")
60+
By("removing restricted namespace label")
6161
_ = kbc.RemoveNamespaceLabelToEnforceRestricted()
6262

63-
By("clean up API objects created during the test")
63+
By("undeploy the project")
6464
_ = kbc.Make("undeploy")
6565

66+
By("uninstalling the project")
67+
_ = kbc.Make("uninstall")
68+
6669
By("removing controller image and working dir")
6770
kbc.Destroy()
6871
})
@@ -91,22 +94,19 @@ var _ = Describe("kubebuilder", func() {
9194
// FIXME: This test is currently disabled because it requires to be fixed:
9295
// https://github.com/kubernetes-sigs/kubebuilder/issues/4853
9396
// 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-
// })
98-
It("should generate a runnable project with webhooks and metrics protected by network policies", func() {
99-
GenerateV4WithNetworkPolicies(kbc)
100-
Run(kbc, true, false, false, true, true)
101-
})
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
10597
// It("should generate a runnable project with the manager running "+
10698
// "as restricted and without webhooks", func() {
10799
// GenerateV4WithoutWebhooks(kbc)
108100
// Run(kbc, false, false, false, true, false)
109101
// })
102+
It("should generate a runnable project with metrics protected by network policies", func() {
103+
GenerateV4WithNetworkPoliciesWithoutWebhooks(kbc)
104+
Run(kbc, false, false, false, true, true)
105+
})
106+
It("should generate a runnable project with webhooks and metrics protected by network policies", func() {
107+
GenerateV4WithNetworkPolicies(kbc)
108+
Run(kbc, true, false, false, true, true)
109+
})
110110
})
111111
})
112112

@@ -531,6 +531,16 @@ func getMetricsOutput(kbc *utils.TestContext) string {
531531
}
532532
Eventually(verifyCurlUp, 240*time.Second, time.Second).Should(Succeed())
533533

534+
By("validating that the correct ServiceAccount is being used")
535+
saName := kbc.Kubectl.ServiceAccount
536+
currentSAOutput, err := kbc.Kubectl.Get(
537+
true,
538+
"serviceaccount", saName,
539+
"-o", "jsonpath={.metadata.name}",
540+
)
541+
Expect(err).NotTo(HaveOccurred(), "Failed to fetch the service account")
542+
Expect(currentSAOutput).To(Equal(saName), "The ServiceAccount in use does not match the expected one")
543+
534544
By("validating that the metrics endpoint is serving as expected")
535545
getCurlLogs := func(g Gomega) {
536546
metricsOutput, err = kbc.Kubectl.Logs("curl")
@@ -569,16 +579,6 @@ func metricsShouldBeUnavailable(kbc *utils.TestContext) {
569579
}
570580
Eventually(verifyCurlUp, 240*time.Second, time.Second).Should(Succeed())
571581

572-
By("validating that the correct ServiceAccount is being used")
573-
saName := kbc.Kubectl.ServiceAccount
574-
currentSAOutput, err := kbc.Kubectl.Get(
575-
true,
576-
"serviceaccount", saName,
577-
"-o", "jsonpath={.metadata.name}",
578-
)
579-
Expect(err).NotTo(HaveOccurred(), "Failed to fetch the service account")
580-
Expect(currentSAOutput).To(Equal(saName), "The ServiceAccount in use does not match the expected one")
581-
582582
By("validating that the metrics endpoint is not working as expected")
583583
getCurlLogs := func(g Gomega) {
584584
metricsOutput, err := kbc.Kubectl.Logs("curl")
@@ -626,7 +626,7 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
626626

627627
func removeCurlPod(kbc *utils.TestContext) {
628628
By("cleaning up the curl pod")
629-
_, err := kbc.Kubectl.Delete(true, "pods/curl")
629+
_, err := kbc.Kubectl.Delete(true, "pods/curl", "--grace-period=0", "--force")
630630
Expect(err).NotTo(HaveOccurred())
631631
}
632632

0 commit comments

Comments
 (0)