@@ -52,7 +52,11 @@ import (
52
52
53
53
var _ = Describe ("Install Plan" , func () {
54
54
55
- var ns corev1.Namespace
55
+ var (
56
+ c operatorclient.ClientInterface
57
+ crc versioned.Interface
58
+ ns corev1.Namespace
59
+ )
56
60
57
61
BeforeEach (func () {
58
62
namespaceName := genName ("install-plan-e2e-" )
@@ -63,6 +67,8 @@ var _ = Describe("Install Plan", func() {
63
67
},
64
68
}
65
69
ns = SetupGeneratedTestNamespaceWithOperatorGroup (namespaceName , og )
70
+ c = ctx .Ctx ().KubeClient ()
71
+ crc = ctx .Ctx ().OperatorClient ()
66
72
})
67
73
68
74
AfterEach (func () {
@@ -688,8 +694,6 @@ var _ = Describe("Install Plan", func() {
688
694
mainCSV := newCSV (mainPackageStable , ns .GetName (), "" , semver .MustParse ("0.1.0" ), nil , []apiextensions.CustomResourceDefinition {dependentCRD }, nil )
689
695
dependentCSV := newCSV (dependentPackageStable , ns .GetName (), "" , semver .MustParse ("0.1.0" ), []apiextensions.CustomResourceDefinition {dependentCRD }, nil , nil )
690
696
691
- c := newKubeClient ()
692
- crc := newCRClient ()
693
697
defer func () {
694
698
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
695
699
}()
@@ -894,8 +898,6 @@ var _ = Describe("Install Plan", func() {
894
898
}).Should (Succeed ())
895
899
}()
896
900
897
- c := newKubeClient ()
898
- crc := newCRClient ()
899
901
defer func () {
900
902
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
901
903
}()
@@ -1310,9 +1312,6 @@ var _ = Describe("Install Plan", func() {
1310
1312
}
1311
1313
}()
1312
1314
1313
- c := newKubeClient ()
1314
- crc := newCRClient ()
1315
-
1316
1315
// Existing custom resource
1317
1316
existingCR := & unstructured.Unstructured {
1318
1317
Object : map [string ]interface {}{
@@ -1569,9 +1568,6 @@ var _ = Describe("Install Plan", func() {
1569
1568
}
1570
1569
}()
1571
1570
1572
- c := newKubeClient ()
1573
- crc := newCRClient ()
1574
-
1575
1571
// Defer crd clean up
1576
1572
defer func () {
1577
1573
Expect (client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), tt .newCRD ))).To (Succeed ())
@@ -1708,8 +1704,6 @@ var _ = Describe("Install Plan", func() {
1708
1704
}
1709
1705
It ("AmplifyPermissions" , func () {
1710
1706
1711
- c := newKubeClient ()
1712
- crc := newCRClient ()
1713
1707
defer func () {
1714
1708
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
1715
1709
}()
@@ -1897,8 +1891,6 @@ var _ = Describe("Install Plan", func() {
1897
1891
})
1898
1892
It ("AttenuatePermissions" , func () {
1899
1893
1900
- c := newKubeClient ()
1901
- crc := newCRClient ()
1902
1894
defer func () {
1903
1895
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
1904
1896
}()
@@ -2124,8 +2116,6 @@ var _ = Describe("Install Plan", func() {
2124
2116
2125
2117
It ("StopOnCSVModifications" , func () {
2126
2118
2127
- c := newKubeClient ()
2128
- crc := newCRClient ()
2129
2119
defer func () {
2130
2120
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
2131
2121
}()
@@ -2438,8 +2428,6 @@ var _ = Describe("Install Plan", func() {
2438
2428
}).Should (Succeed ())
2439
2429
}()
2440
2430
2441
- c := newKubeClient ()
2442
- crc := newCRClient ()
2443
2431
defer func () {
2444
2432
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
2445
2433
}()
@@ -2545,8 +2533,6 @@ var _ = Describe("Install Plan", func() {
2545
2533
2546
2534
It ("UpdatePreexistingCRDFailed" , func () {
2547
2535
2548
- c := newKubeClient ()
2549
- crc := newCRClient ()
2550
2536
defer func () {
2551
2537
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
2552
2538
}()
@@ -2795,8 +2781,6 @@ var _ = Describe("Install Plan", func() {
2795
2781
// Create new CSVs
2796
2782
stableCSV := newCSV (stableCSVName , ns .GetName (), "" , semver .MustParse ("0.1.0" ), []apiextensions.CustomResourceDefinition {crd }, nil , & namedStrategy )
2797
2783
2798
- c := newKubeClient ()
2799
- crc := newCRClient ()
2800
2784
defer func () {
2801
2785
require .NoError (GinkgoT (), crc .OperatorsV1alpha1 ().Subscriptions (ns .GetName ()).DeleteCollection (context .Background (), metav1.DeleteOptions {}, metav1.ListOptions {}))
2802
2786
}()
@@ -3050,9 +3034,6 @@ var _ = Describe("Install Plan", func() {
3050
3034
}
3051
3035
3052
3036
// Create the CatalogSource
3053
- c := newKubeClient ()
3054
- crc := newCRClient ()
3055
-
3056
3037
catalogSourceName := genName ("mock-nginx-" )
3057
3038
_ , cleanupCatalogSource := createInternalCatalogSource (c , crc , catalogSourceName , ns .GetName (), manifests , []apiextensions.CustomResourceDefinition {crd }, []operatorsv1alpha1.ClusterServiceVersion {csv })
3058
3039
defer cleanupCatalogSource ()
@@ -3080,10 +3061,6 @@ var _ = Describe("Install Plan", func() {
3080
3061
})
3081
3062
3082
3063
It ("unpacks bundle image" , func () {
3083
-
3084
- c := newKubeClient ()
3085
- crc := newCRClient ()
3086
-
3087
3064
ns , err := c .KubernetesInterface ().CoreV1 ().Namespaces ().Create (context .Background (), & corev1.Namespace {
3088
3065
ObjectMeta : metav1.ObjectMeta {
3089
3066
Name : genName ("ns-" ),
@@ -3183,9 +3160,6 @@ var _ = Describe("Install Plan", func() {
3183
3160
ns := & corev1.Namespace {}
3184
3161
ns .SetName (genName ("ns-" ))
3185
3162
3186
- c := newKubeClient ()
3187
- crc := newCRClient ()
3188
-
3189
3163
// Create a namespace an OperatorGroup
3190
3164
ns , err := c .KubernetesInterface ().CoreV1 ().Namespaces ().Create (context .Background (), ns , metav1.CreateOptions {})
3191
3165
require .NoError (GinkgoT (), err )
@@ -3327,14 +3301,10 @@ var _ = Describe("Install Plan", func() {
3327
3301
When ("an InstallPlan is created with no valid OperatorGroup present" , func () {
3328
3302
3329
3303
var (
3330
- c operatorclient.ClientInterface
3331
- crc versioned.Interface
3332
3304
installPlanName string
3333
3305
ns * corev1.Namespace
3334
3306
)
3335
3307
BeforeEach (func () {
3336
- c = newKubeClient ()
3337
- crc = newCRClient ()
3338
3308
3339
3309
ns = & corev1.Namespace {}
3340
3310
ns .SetName (genName ("ns-" ))
@@ -3637,9 +3607,6 @@ var _ = Describe("Install Plan", func() {
3637
3607
// Test ensures that all steps for index-based catalogs are references to configmaps. This avoids the problem
3638
3608
// of installplans growing beyond the etcd size limit when manifests are written to the ip status.
3639
3609
3640
- c := newKubeClient ()
3641
- crc := newCRClient ()
3642
-
3643
3610
ns , err := c .KubernetesInterface ().CoreV1 ().Namespaces ().Create (context .Background (), & corev1.Namespace {
3644
3611
ObjectMeta : metav1.ObjectMeta {
3645
3612
Name : genName ("ns-" ),
@@ -3723,8 +3690,6 @@ var _ = Describe("Install Plan", func() {
3723
3690
})
3724
3691
3725
3692
It ("limits installed resources if the scoped serviceaccount has no permissions" , func () {
3726
- c := newKubeClient ()
3727
- crc := newCRClient ()
3728
3693
3729
3694
By ("creating a scoped serviceaccount specified in the operatorgroup" )
3730
3695
ns , err := c .KubernetesInterface ().CoreV1 ().Namespaces ().Create (context .Background (), & corev1.Namespace {
@@ -3966,8 +3931,6 @@ var _ = Describe("Install Plan", func() {
3966
3931
})
3967
3932
3968
3933
It ("uses the correct client when installing resources from an installplan" , func () {
3969
- c := newKubeClient ()
3970
- crc := newCRClient ()
3971
3934
3972
3935
By ("creating a scoped serviceaccount specifified in the operatorgroup" )
3973
3936
ns , err := c .KubernetesInterface ().CoreV1 ().Namespaces ().Create (context .Background (), & corev1.Namespace {
0 commit comments