@@ -85,10 +85,10 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
85
85
86
86
defer func () {
87
87
Eventually (func () error {
88
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), crd .GetName (), metav1.DeleteOptions {})
88
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), crd .GetName (), metav1.DeleteOptions {})
89
89
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
90
90
Eventually (func () error {
91
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & csv ))
91
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & csv ))
92
92
}).Should (Succeed ())
93
93
}()
94
94
@@ -151,13 +151,13 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
151
151
152
152
defer func () {
153
153
Eventually (func () error {
154
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), mainCRD .GetName (), metav1.DeleteOptions {})
154
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), mainCRD .GetName (), metav1.DeleteOptions {})
155
155
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
156
156
Eventually (func () error {
157
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & mainCSV ))
157
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & mainCSV ))
158
158
}).Should (Succeed ())
159
159
Eventually (func () error {
160
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & replacementCSV ))
160
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & replacementCSV ))
161
161
}).Should (Succeed ())
162
162
}()
163
163
@@ -201,12 +201,17 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
201
201
202
202
installPlanName := subscription .Status .Install .Name
203
203
requiresApprovalChecker := buildInstallPlanPhaseCheckFunc (v1alpha1 .InstallPlanPhaseRequiresApproval )
204
- fetchedInstallPlan , err := fetchInstallPlanWithNamespace (GinkgoT (), crc , installPlanName , ns .GetName (), requiresApprovalChecker )
205
- Expect (err ).ShouldNot (HaveOccurred ())
206
204
207
- fetchedInstallPlan .Spec .Approved = true
208
- _ , err = crc .OperatorsV1alpha1 ().InstallPlans (ns .GetName ()).Update (context .Background (), fetchedInstallPlan , metav1.UpdateOptions {})
209
- Expect (err ).ShouldNot (HaveOccurred ())
205
+ Eventually (func () error {
206
+ fetchedInstallPlan , err := fetchInstallPlanWithNamespace (GinkgoT (), crc , installPlanName , ns .GetName (), requiresApprovalChecker )
207
+ if err != nil {
208
+ return err
209
+ }
210
+
211
+ fetchedInstallPlan .Spec .Approved = true
212
+ _ , err = crc .OperatorsV1alpha1 ().InstallPlans (ns .GetName ()).Update (context .Background (), fetchedInstallPlan , metav1.UpdateOptions {})
213
+ return err
214
+ }).Should (Succeed ())
210
215
211
216
_ , err = awaitCSV (crc , ns .GetName (), mainCSV .GetName (), csvSucceededChecker )
212
217
Expect (err ).ShouldNot (HaveOccurred ())
@@ -255,13 +260,13 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
255
260
256
261
defer func () {
257
262
Eventually (func () error {
258
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), dependentCRD .GetName (), metav1.DeleteOptions {})
263
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), dependentCRD .GetName (), metav1.DeleteOptions {})
259
264
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
260
265
Eventually (func () error {
261
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & mainCSV ))
266
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & mainCSV ))
262
267
}).Should (Succeed ())
263
268
Eventually (func () error {
264
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & dependentCSV ))
269
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & dependentCSV ))
265
270
}).Should (Succeed ())
266
271
}()
267
272
@@ -388,13 +393,13 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
388
393
389
394
defer func () {
390
395
Eventually (func () error {
391
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), dependentCRD .GetName (), metav1.DeleteOptions {})
396
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), dependentCRD .GetName (), metav1.DeleteOptions {})
392
397
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
393
398
Eventually (func () error {
394
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & mainCSV ))
399
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & mainCSV ))
395
400
}).Should (Succeed ())
396
401
Eventually (func () error {
397
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & dependentCSV ))
402
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & dependentCSV ))
398
403
}).Should (Succeed ())
399
404
}()
400
405
@@ -482,16 +487,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
482
487
483
488
defer func () {
484
489
Eventually (func () error {
485
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), dependentCRD .GetName (), metav1.DeleteOptions {})
490
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), dependentCRD .GetName (), metav1.DeleteOptions {})
486
491
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
487
492
Eventually (func () error {
488
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & mainCSV ))
493
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & mainCSV ))
489
494
}).Should (Succeed ())
490
495
Eventually (func () error {
491
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & dependentCSV ))
496
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & dependentCSV ))
492
497
}).Should (Succeed ())
493
498
Eventually (func () error {
494
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & replacementCSV ))
499
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & replacementCSV ))
495
500
}).Should (Succeed ())
496
501
}()
497
502
@@ -592,11 +597,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
592
597
Expect (err ).ShouldNot (HaveOccurred ())
593
598
594
599
// Update the catalog's address to point at the other registry pod's cluster ip
595
- addressSource , err = crc .OperatorsV1alpha1 ().CatalogSources (ns .GetName ()).Get (context .Background (), addressSourceName , metav1.GetOptions {})
596
- Expect (err ).ShouldNot (HaveOccurred ())
597
- addressSource .Spec .Address = net .JoinHostPort (replacementCopy .Status .PodIP , "50051" )
598
- _ , err = crc .OperatorsV1alpha1 ().CatalogSources (ns .GetName ()).Update (context .Background (), addressSource , metav1.UpdateOptions {})
599
- Expect (err ).ShouldNot (HaveOccurred ())
600
+ Eventually (func () error {
601
+ addressSource , err = crc .OperatorsV1alpha1 ().CatalogSources (ns .GetName ()).Get (context .Background (), addressSourceName , metav1.GetOptions {})
602
+ if err != nil {
603
+ return err
604
+ }
605
+
606
+ addressSource .Spec .Address = net .JoinHostPort (replacementCopy .Status .PodIP , "50051" )
607
+ _ , err = crc .OperatorsV1alpha1 ().CatalogSources (ns .GetName ()).Update (context .Background (), addressSource , metav1.UpdateOptions {})
608
+ return err
609
+ }).Should (Succeed ())
600
610
601
611
// Wait for the replacement CSV to be installed
602
612
_ , err = awaitCSV (crc , ns .GetName (), replacementCSV .GetName (), csvSucceededChecker )
@@ -629,10 +639,10 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
629
639
630
640
defer func () {
631
641
Eventually (func () error {
632
- return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .TODO (), crd .GetName (), metav1.DeleteOptions {})
642
+ return ctx .Ctx ().KubeClient ().ApiextensionsInterface ().ApiextensionsV1 ().CustomResourceDefinitions ().Delete (context .Background (), crd .GetName (), metav1.DeleteOptions {})
633
643
}).Should (Or (Succeed (), WithTransform (k8serror .IsNotFound , BeTrue ())))
634
644
Eventually (func () error {
635
- return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .TODO (), & csv ))
645
+ return client .IgnoreNotFound (ctx .Ctx ().Client ().Delete (context .Background (), & csv ))
636
646
}).Should (Succeed ())
637
647
}()
638
648
@@ -892,12 +902,17 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
892
902
}
893
903
894
904
// update catalog source with annotation (to kick resync)
895
- source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
896
- Expect (err ).ShouldNot (HaveOccurred (), "error awaiting registry pod" )
897
- source .Annotations = make (map [string ]string )
898
- source .Annotations ["testKey" ] = "testValue"
899
- _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
900
- Expect (err ).ShouldNot (HaveOccurred (), "error awaiting registry pod" )
905
+ Eventually (func () error {
906
+ source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
907
+ if err != nil {
908
+ return nil
909
+ }
910
+
911
+ source .Annotations = make (map [string ]string )
912
+ source .Annotations ["testKey" ] = "testValue"
913
+ _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
914
+ return err
915
+ }).Should (Succeed ())
901
916
902
917
time .Sleep (11 * time .Second )
903
918
@@ -916,11 +931,21 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
916
931
}
917
932
}
918
933
// update catalog source with annotation (to kick resync)
919
- source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
920
- Expect (err ).ShouldNot (HaveOccurred (), "error getting catalog source pod" )
921
- source .Annotations ["testKey" ] = genName ("newValue" )
922
- _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
923
- Expect (err ).ShouldNot (HaveOccurred (), "error updating catalog source pod with test annotation" )
934
+ Eventually (func () error {
935
+ source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
936
+ if err != nil {
937
+ return err
938
+ }
939
+
940
+ if source .Annotations == nil {
941
+ source .Annotations = make (map [string ]string )
942
+ }
943
+
944
+ source .Annotations ["testKey" ] = genName ("newValue" )
945
+ _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
946
+ return err
947
+ }).Should (Succeed ())
948
+
924
949
return false
925
950
}
926
951
// await new catalog source and ensure old one was deleted
@@ -930,11 +955,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
930
955
Expect (registryPods .Items ).To (HaveLen (1 ), "unexpected number of registry pods found" )
931
956
932
957
// update catalog source with annotation (to kick resync)
933
- source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
934
- Expect (err ).ShouldNot (HaveOccurred (), "error awaiting registry pod" )
935
- source .Annotations ["testKey" ] = "newValue"
936
- _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
937
- Expect (err ).ShouldNot (HaveOccurred (), "error awaiting registry pod" )
958
+ Eventually (func () error {
959
+ source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
960
+ if err != nil {
961
+ return err
962
+ }
963
+
964
+ source .Annotations ["testKey" ] = "newValue"
965
+ _ , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), source , metav1.UpdateOptions {})
966
+ return err
967
+ }).Should (Succeed ())
938
968
939
969
subChecker := func (sub * v1alpha1.Subscription ) bool {
940
970
return sub .Status .InstalledCSV == "busybox.v2.0.0"
@@ -1030,19 +1060,16 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
1030
1060
Expect (subscription .Status .InstalledCSV ).To (Equal ("busybox-dependency.v1.0.0" ))
1031
1061
1032
1062
// Update the catalog image
1033
- Eventually (func () ( bool , error ) {
1063
+ Eventually (func () error {
1034
1064
existingSource , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), sourceName , metav1.GetOptions {})
1035
1065
if err != nil {
1036
- return false , err
1066
+ return err
1037
1067
}
1038
1068
existingSource .Spec .Image = catSrcImage + ":2.0.0-with-ListBundles-method"
1039
1069
1040
1070
source , err = crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Update (context .Background (), existingSource , metav1.UpdateOptions {})
1041
- if err == nil {
1042
- return true , nil
1043
- }
1044
- return false , nil
1045
- }).Should (BeTrue ())
1071
+ return err
1072
+ }).Should (Succeed ())
1046
1073
1047
1074
// Wait for the CatalogSource to be ready
1048
1075
_ , err = fetchCatalogSourceOnStatus (crc , source .GetName (), source .GetNamespace (), catalogSourceRegistryPodSynced )
@@ -1102,7 +1129,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
1102
1129
},
1103
1130
}
1104
1131
1105
- source , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Create (context .TODO (), source , metav1.CreateOptions {})
1132
+ source , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Create (context .Background (), source , metav1.CreateOptions {})
1106
1133
Expect (err ).ToNot (HaveOccurred ())
1107
1134
1108
1135
// wait for new catalog source pod to be created and report ready
@@ -1113,7 +1140,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
1113
1140
Expect (catalogPods ).ToNot (BeNil ())
1114
1141
1115
1142
Eventually (func () (bool , error ) {
1116
- podList , err := c .KubernetesInterface ().CoreV1 ().Pods (source .GetNamespace ()).List (context .TODO (), metav1.ListOptions {LabelSelector : selector .String ()})
1143
+ podList , err := c .KubernetesInterface ().CoreV1 ().Pods (source .GetNamespace ()).List (context .Background (), metav1.ListOptions {LabelSelector : selector .String ()})
1117
1144
if err != nil {
1118
1145
return false , err
1119
1146
}
@@ -1179,17 +1206,17 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
1179
1206
},
1180
1207
}
1181
1208
1182
- _ , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Create (context .TODO (), source , metav1.CreateOptions {})
1209
+ _ , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Create (context .Background (), source , metav1.CreateOptions {})
1183
1210
Expect (err ).ToNot (HaveOccurred ())
1184
1211
1185
1212
})
1186
1213
AfterEach (func () {
1187
- err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Delete (context .TODO (), source .GetName (), metav1.DeleteOptions {})
1214
+ err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Delete (context .Background (), source .GetName (), metav1.DeleteOptions {})
1188
1215
Expect (err ).ToNot (HaveOccurred ())
1189
1216
})
1190
1217
It ("the catalogsource status communicates that a default interval time is being used instead" , func () {
1191
1218
Eventually (func () bool {
1192
- catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .TODO (), source .GetName (), metav1.GetOptions {})
1219
+ catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
1193
1220
Expect (err ).ToNot (HaveOccurred ())
1194
1221
if catsrc .Status .Reason == v1alpha1 .CatalogSourceIntervalInvalidError {
1195
1222
if catsrc .Status .Message == "error parsing spec.updateStrategy.registryPoll.interval. Using the default value of 15m0s instead. Error: time: unknown unit \" mError\" in duration \" 45mError.code\" " {
@@ -1201,15 +1228,19 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
1201
1228
})
1202
1229
When ("the catalogsource is updated with a valid polling interval" , func () {
1203
1230
BeforeEach (func () {
1204
- catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .TODO (), source .GetName (), metav1.GetOptions {})
1205
- Expect (err ).ToNot (HaveOccurred ())
1206
- catsrc .Spec .UpdateStrategy .RegistryPoll .RawInterval = correctInterval
1207
- _ , err = crc .OperatorsV1alpha1 ().CatalogSources (catsrc .GetNamespace ()).Update (context .TODO (), catsrc , metav1.UpdateOptions {})
1208
- Expect (err ).ToNot (HaveOccurred ())
1231
+ Eventually (func () error {
1232
+ catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
1233
+ if err != nil {
1234
+ return err
1235
+ }
1236
+ catsrc .Spec .UpdateStrategy .RegistryPoll .RawInterval = correctInterval
1237
+ _ , err = crc .OperatorsV1alpha1 ().CatalogSources (catsrc .GetNamespace ()).Update (context .Background (), catsrc , metav1.UpdateOptions {})
1238
+ return err
1239
+ }).Should (Succeed ())
1209
1240
})
1210
1241
It ("the catalogsource spec shows the updated polling interval, and the error message in the status is cleared" , func () {
1211
1242
Eventually (func () error {
1212
- catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .TODO (), source .GetName (), metav1.GetOptions {})
1243
+ catsrc , err := crc .OperatorsV1alpha1 ().CatalogSources (source .GetNamespace ()).Get (context .Background (), source .GetName (), metav1.GetOptions {})
1213
1244
if err != nil {
1214
1245
return err
1215
1246
}
0 commit comments