@@ -57,12 +57,15 @@ var _ = Describe("kubebuilder", func() {
57
57
})
58
58
59
59
AfterEach (func () {
60
- By ("By removing restricted namespace label" )
60
+ By ("removing restricted namespace label" )
61
61
_ = kbc .RemoveNamespaceLabelToEnforceRestricted ()
62
62
63
- By ("clean up API objects created during the test " )
63
+ By ("undeploy the project " )
64
64
_ = kbc .Make ("undeploy" )
65
65
66
+ By ("uninstalling the project" )
67
+ _ = kbc .Make ("uninstall" )
68
+
66
69
By ("removing controller image and working dir" )
67
70
kbc .Destroy ()
68
71
})
@@ -531,6 +534,16 @@ func getMetricsOutput(kbc *utils.TestContext) string {
531
534
}
532
535
Eventually (verifyCurlUp , 240 * time .Second , time .Second ).Should (Succeed ())
533
536
537
+ By ("validating that the correct ServiceAccount is being used" )
538
+ saName := kbc .Kubectl .ServiceAccount
539
+ currentSAOutput , err := kbc .Kubectl .Get (
540
+ true ,
541
+ "serviceaccount" , saName ,
542
+ "-o" , "jsonpath={.metadata.name}" ,
543
+ )
544
+ Expect (err ).NotTo (HaveOccurred (), "Failed to fetch the service account" )
545
+ Expect (currentSAOutput ).To (Equal (saName ), "The ServiceAccount in use does not match the expected one" )
546
+
534
547
By ("validating that the metrics endpoint is serving as expected" )
535
548
getCurlLogs := func (g Gomega ) {
536
549
metricsOutput , err = kbc .Kubectl .Logs ("curl" )
@@ -569,16 +582,6 @@ func metricsShouldBeUnavailable(kbc *utils.TestContext) {
569
582
}
570
583
Eventually (verifyCurlUp , 240 * time .Second , time .Second ).Should (Succeed ())
571
584
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
-
582
585
By ("validating that the metrics endpoint is not working as expected" )
583
586
getCurlLogs := func (g Gomega ) {
584
587
metricsOutput , err := kbc .Kubectl .Logs ("curl" )
@@ -626,7 +629,7 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
626
629
627
630
func removeCurlPod (kbc * utils.TestContext ) {
628
631
By ("cleaning up the curl pod" )
629
- _ , err := kbc .Kubectl .Delete (true , "pods/curl" )
632
+ _ , err := kbc .Kubectl .Delete (true , "pods/curl" , "--grace-period=0" , "--force" )
630
633
Expect (err ).NotTo (HaveOccurred ())
631
634
}
632
635
0 commit comments