@@ -36,23 +36,23 @@ import (
3636)
3737
3838var _ = Describe ("ClusterServiceVersion" , func () {
39-
4039 var (
4140 ns corev1.Namespace
4241 c operatorclient.ClientInterface
4342 crc versioned.Interface
4443 )
4544
4645 BeforeEach (func () {
47- c = newKubeClient ()
48- crc = newCRClient ()
46+ c = ctx . Ctx (). KubeClient ()
47+ crc = ctx . Ctx (). OperatorClient ()
4948 })
5049
5150 AfterEach (func () {
5251 TeardownNamespace (ns .GetName ())
5352 })
5453
5554 Context ("OwnNamespace OperatorGroup" , func () {
55+
5656 BeforeEach (func () {
5757 nsName := genName ("csv-e2e-" )
5858 ns = SetupGeneratedTestNamespace (nsName , nsName )
@@ -280,7 +280,6 @@ var _ = Describe("ClusterServiceVersion", func() {
280280 })
281281
282282 When ("an unassociated ClusterServiceVersion in different namespace owns the same CRD" , func () {
283-
284283 var (
285284 crd apiextensionsv1.CustomResourceDefinition
286285 apiname string
@@ -401,6 +400,7 @@ var _ = Describe("ClusterServiceVersion", func() {
401400 })
402401
403402 Context ("AllNamespaces OperatorGroup" , func () {
403+
404404 BeforeEach (func () {
405405 ns = SetupGeneratedTestNamespace (genName ("csv-e2e-" ))
406406 })
@@ -3966,7 +3966,7 @@ var _ = Describe("ClusterServiceVersion", func() {
39663966 csv .SetName ("csv-hat-1" )
39673967 csv .SetNamespace (ns .GetName ())
39683968
3969- createLegacyAPIResources (ns .GetName (), & csv , owned [0 ])
3969+ createLegacyAPIResources (ns .GetName (), & csv , owned [0 ], c )
39703970
39713971 // Create the APIService CSV
39723972 cleanupCSV , err := createCSV (c , crc , csv , ns .GetName (), false , false )
@@ -3976,7 +3976,7 @@ var _ = Describe("ClusterServiceVersion", func() {
39763976 _ , err = fetchCSV (crc , csv .Name , ns .GetName (), csvSucceededChecker )
39773977 Expect (err ).ShouldNot (HaveOccurred ())
39783978
3979- checkLegacyAPIResources (ns .GetName (), owned [0 ], true )
3979+ checkLegacyAPIResources (ns .GetName (), owned [0 ], true , c )
39803980 })
39813981
39823982 It ("API service resource not migrated if not adoptable" , func () {
@@ -4046,7 +4046,7 @@ var _ = Describe("ClusterServiceVersion", func() {
40464046 csv .SetName ("csv-hat-1" )
40474047 csv .SetNamespace (ns .GetName ())
40484048
4049- createLegacyAPIResources (ns .GetName (), nil , owned [0 ])
4049+ createLegacyAPIResources (ns .GetName (), nil , owned [0 ], c )
40504050
40514051 // Create the APIService CSV
40524052 cleanupCSV , err := createCSV (c , crc , csv , ns .GetName (), false , false )
@@ -4056,10 +4056,10 @@ var _ = Describe("ClusterServiceVersion", func() {
40564056 _ , err = fetchCSV (crc , csv .Name , ns .GetName (), csvSucceededChecker )
40574057 Expect (err ).ShouldNot (HaveOccurred ())
40584058
4059- checkLegacyAPIResources (ns .GetName (), owned [0 ], false )
4059+ checkLegacyAPIResources (ns .GetName (), owned [0 ], false , c )
40604060
40614061 // 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 )
40634063 })
40644064
40654065 It ("multiple API services on a single pod" , func () {
@@ -4510,9 +4510,7 @@ func csvExists(namespace string, c versioned.Interface, name string) bool {
45104510 return true
45114511}
45124512
4513- func deleteLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription ) {
4514- c := newKubeClient ()
4515-
4513+ func deleteLegacyAPIResources (namespace string , desc operatorsv1alpha1.APIServiceDescription , c operatorclient.ClientInterface ) {
45164514 apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
45174515
45184516 err := c .DeleteService (namespace , strings .Replace (apiServiceName , "." , "-" , - 1 ), & metav1.DeleteOptions {})
@@ -4534,8 +4532,7 @@ func deleteLegacyAPIResources(namespace string, desc operatorsv1alpha1.APIServic
45344532 Expect (err ).ShouldNot (HaveOccurred ())
45354533}
45364534
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 ) {
45394536
45404537 apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
45414538
@@ -4621,8 +4618,7 @@ func createLegacyAPIResources(namespace string, csv *operatorsv1alpha1.ClusterSe
46214618 Expect (err ).ShouldNot (HaveOccurred ())
46224619}
46234620
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 ) {
46264622 apiServiceName := fmt .Sprintf ("%s.%s" , desc .Version , desc .Group )
46274623
46284624 // Attempt to create the legacy service
0 commit comments