@@ -36,23 +36,23 @@ import (
36
36
)
37
37
38
38
var _ = Describe ("ClusterServiceVersion" , func () {
39
-
40
39
var (
41
40
ns corev1.Namespace
42
41
c operatorclient.ClientInterface
43
42
crc versioned.Interface
44
43
)
45
44
46
45
BeforeEach (func () {
47
- c = newKubeClient ()
48
- crc = newCRClient ()
46
+ c = ctx . Ctx (). KubeClient ()
47
+ crc = ctx . Ctx (). OperatorClient ()
49
48
})
50
49
51
50
AfterEach (func () {
52
51
TeardownNamespace (ns .GetName ())
53
52
})
54
53
55
54
Context ("OwnNamespace OperatorGroup" , func () {
55
+
56
56
BeforeEach (func () {
57
57
nsName := genName ("csv-e2e-" )
58
58
ns = SetupGeneratedTestNamespace (nsName , nsName )
@@ -280,7 +280,6 @@ var _ = Describe("ClusterServiceVersion", func() {
280
280
})
281
281
282
282
When ("an unassociated ClusterServiceVersion in different namespace owns the same CRD" , func () {
283
-
284
283
var (
285
284
crd apiextensionsv1.CustomResourceDefinition
286
285
apiname string
@@ -401,6 +400,7 @@ var _ = Describe("ClusterServiceVersion", func() {
401
400
})
402
401
403
402
Context ("AllNamespaces OperatorGroup" , func () {
403
+
404
404
BeforeEach (func () {
405
405
ns = SetupGeneratedTestNamespace (genName ("csv-e2e-" ))
406
406
})
@@ -3966,7 +3966,7 @@ var _ = Describe("ClusterServiceVersion", func() {
3966
3966
csv .SetName ("csv-hat-1" )
3967
3967
csv .SetNamespace (ns .GetName ())
3968
3968
3969
- createLegacyAPIResources (ns .GetName (), & csv , owned [0 ])
3969
+ createLegacyAPIResources (ns .GetName (), & csv , owned [0 ], c )
3970
3970
3971
3971
// Create the APIService CSV
3972
3972
cleanupCSV , err := createCSV (c , crc , csv , ns .GetName (), false , false )
@@ -3976,7 +3976,7 @@ var _ = Describe("ClusterServiceVersion", func() {
3976
3976
_ , err = fetchCSV (crc , csv .Name , ns .GetName (), csvSucceededChecker )
3977
3977
Expect (err ).ShouldNot (HaveOccurred ())
3978
3978
3979
- checkLegacyAPIResources (ns .GetName (), owned [0 ], true )
3979
+ checkLegacyAPIResources (ns .GetName (), owned [0 ], true , c )
3980
3980
})
3981
3981
3982
3982
It ("API service resource not migrated if not adoptable" , func () {
@@ -4046,7 +4046,7 @@ var _ = Describe("ClusterServiceVersion", func() {
4046
4046
csv .SetName ("csv-hat-1" )
4047
4047
csv .SetNamespace (ns .GetName ())
4048
4048
4049
- createLegacyAPIResources (ns .GetName (), nil , owned [0 ])
4049
+ createLegacyAPIResources (ns .GetName (), nil , owned [0 ], c )
4050
4050
4051
4051
// Create the APIService CSV
4052
4052
cleanupCSV , err := createCSV (c , crc , csv , ns .GetName (), false , false )
@@ -4056,10 +4056,10 @@ var _ = Describe("ClusterServiceVersion", func() {
4056
4056
_ , err = fetchCSV (crc , csv .Name , ns .GetName (), csvSucceededChecker )
4057
4057
Expect (err ).ShouldNot (HaveOccurred ())
4058
4058
4059
- checkLegacyAPIResources (ns .GetName (), owned [0 ], false )
4059
+ checkLegacyAPIResources (ns .GetName (), owned [0 ], false , c )
4060
4060
4061
4061
// Cleanup the resources created for this test that were not cleaned up.
4062
- deleteLegacyAPIResources (ns .GetName (), owned [0 ])
4062
+ deleteLegacyAPIResources (ns .GetName (), owned [0 ], c )
4063
4063
})
4064
4064
4065
4065
It ("multiple API services on a single pod" , func () {
@@ -4510,9 +4510,7 @@ func csvExists(namespace string, c versioned.Interface, name string) bool {
4510
4510
return true
4511
4511
}
4512
4512
4513
- func deleteLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription ) {
4514
- c := newKubeClient ()
4515
-
4513
+ func deleteLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription , c operatorclient.ClientInterface ) {
4516
4514
apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
4517
4515
4518
4516
err := c .DeleteService (namespace , strings .Replace (apiServiceName , "." , "-" , - 1 ), & metav1.DeleteOptions {})
@@ -4534,8 +4532,7 @@ func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServic
4534
4532
Expect (err ).ShouldNot (HaveOccurred ())
4535
4533
}
4536
4534
4537
- func createLegacyAPIResources (namespace string , csv * operatorsv1alpha1.ClusterServiceVersion , desc operatorsv1alpha1.APIServiceDescription ) {
4538
- c := newKubeClient ()
4535
+ func createLegacyAPIResources (namespace string , csv * operatorsv1alpha1.ClusterServiceVersion , desc operatorsv1alpha1.APIServiceDescription , c operatorclient.ClientInterface ) {
4539
4536
4540
4537
apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
4541
4538
@@ -4621,8 +4618,7 @@ func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterSe
4621
4618
Expect (err ).ShouldNot (HaveOccurred ())
4622
4619
}
4623
4620
4624
- func checkLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription , expectedIsNotFound bool ) {
4625
- c := newKubeClient ()
4621
+ func checkLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription , expectedIsNotFound bool , c operatorclient.ClientInterface ) {
4626
4622
apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
4627
4623
4628
4624
// Attempt to create the legacy service
0 commit comments