@@ -51,6 +51,12 @@ var _ = Describe("Operator API", func() {
51
51
Expect (err ).ToNot (HaveOccurred ())
52
52
})
53
53
54
+ AfterEach (func () {
55
+ Eventually (func () error {
56
+ return operatorClient .DeleteCollection (clientCtx , metav1.DeleteOptions {}, listOpts )
57
+ }).Should (Succeed ())
58
+ })
59
+
54
60
// Ensures that an Operator resource can select its components by label and surface them correctly in its status.
55
61
//
56
62
// Steps:
@@ -74,12 +80,12 @@ var _ = Describe("Operator API", func() {
74
80
o := & operatorsv1.Operator {}
75
81
o .SetName (genName ("o-" ))
76
82
77
- Consistently (o ).ShouldNot (ContainCopiedCSVReferences ())
78
-
79
83
Eventually (func () error {
80
84
return client .Create (clientCtx , o )
81
85
}).Should (Succeed ())
82
86
87
+ Consistently (o ).ShouldNot (ContainCopiedCSVReferences ())
88
+
83
89
defer func () {
84
90
Eventually (func () error {
85
91
err := client .Delete (clientCtx , o )
@@ -323,12 +329,21 @@ var _ = Describe("Operator API", func() {
323
329
})
324
330
325
331
AfterEach (func () {
332
+ By ("Deleting the testing namespace" )
326
333
Eventually (func () error {
327
- err := client .Delete (clientCtx , ns )
328
- if apierrors .IsNotFound (err ) {
329
- return nil
330
- }
331
- return err
334
+ return controllerclient .IgnoreNotFound (client .Delete (clientCtx , ns ))
335
+ }).Should (Succeed ())
336
+
337
+ By ("Deleting the kiali-related CRDs" )
338
+ Eventually (func () error {
339
+ return client .DeleteAllOf (clientCtx , & apiextensionsv1.CustomResourceDefinition {}, controllerclient.MatchingLabels {
340
+ fmt .Sprintf ("operators.coreos.com/%s" , operatorName .Name ): "" ,
341
+ })
342
+ }).Should (Succeed ())
343
+
344
+ By ("Deleting the test Operator resource" )
345
+ Eventually (func () error {
346
+ return operatorClient .Delete (clientCtx , operatorName .Name , metav1.DeleteOptions {})
332
347
}).Should (Succeed ())
333
348
})
334
349
0 commit comments