@@ -193,7 +193,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
193
193
194
194
By ("validating that the Prometheus manager has provisioned the Service" )
195
195
Eventually (func (g Gomega ) {
196
- _ , err : = kbc .Kubectl .Get (
196
+ _ , err = kbc .Kubectl .Get (
197
197
false ,
198
198
"Service" , "prometheus-operator" )
199
199
g .Expect (err ).NotTo (HaveOccurred ())
@@ -207,7 +207,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
207
207
208
208
if hasNetworkPolicies {
209
209
By ("Checking for Calico pods" )
210
- outputGet , err := kbc .Kubectl .Get (
210
+ var outputGet string
211
+ outputGet , err = kbc .Kubectl .Get (
211
212
false ,
212
213
"pods" ,
213
214
"-n" , "kube-system" ,
@@ -223,7 +224,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
223
224
"metrics=enabled" )).Error ().NotTo (HaveOccurred ())
224
225
225
226
By ("Ensuring the Allow Metrics Traffic NetworkPolicy exists" , func () {
226
- output , err := kbc .Kubectl .Get (
227
+ var output string
228
+ output , err = kbc .Kubectl .Get (
227
229
true ,
228
230
"networkpolicy" , fmt .Sprintf ("e2e-%s-allow-metrics-traffic" , kbc .TestSuffix ),
229
231
)
@@ -240,7 +242,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
240
242
Expect (err ).NotTo (HaveOccurred ())
241
243
242
244
By ("Ensuring the allow-webhook-traffic NetworkPolicy exists" , func () {
243
- output , err := kbc .Kubectl .Get (
245
+ var output string
246
+ output , err = kbc .Kubectl .Get (
244
247
true ,
245
248
"networkpolicy" , fmt .Sprintf ("e2e-%s-allow-webhook-traffic" , kbc .TestSuffix ),
246
249
)
@@ -255,7 +258,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
255
258
By ("validating that cert-manager has provisioned the certificate Secret" )
256
259
257
260
verifyWebhookCert := func (g Gomega ) {
258
- output , err := kbc .Kubectl .Get (
261
+ var output string
262
+ output , err = kbc .Kubectl .Get (
259
263
true ,
260
264
"secrets" , "webhook-server-cert" )
261
265
g .Expect (err ).ToNot (HaveOccurred (), "webhook-server-cert should exist in the namespace" )
@@ -266,7 +270,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
266
270
267
271
By ("validating that the mutating|validating webhooks have the CA injected" )
268
272
verifyCAInjection := func (g Gomega ) {
269
- mwhOutput , err := kbc .Kubectl .Get (
273
+ var mwhOutput , vwhOutput string
274
+ mwhOutput , err = kbc .Kubectl .Get (
270
275
false ,
271
276
"mutatingwebhookconfigurations.admissionregistration.k8s.io" ,
272
277
fmt .Sprintf ("e2e-%s-mutating-webhook-configuration" , kbc .TestSuffix ),
@@ -275,7 +280,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
275
280
// check that ca should be long enough, because there may be a place holder "\n"
276
281
g .Expect (len (mwhOutput )).To (BeNumerically (">" , 10 ))
277
282
278
- vwhOutput , err : = kbc .Kubectl .Get (
283
+ vwhOutput , err = kbc .Kubectl .Get (
279
284
false ,
280
285
"validatingwebhookconfigurations.admissionregistration.k8s.io" ,
281
286
fmt .Sprintf ("e2e-%s-validating-webhook-configuration" , kbc .TestSuffix ),
@@ -290,7 +295,8 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
290
295
By ("validating that the CA injection is applied for CRD conversion" )
291
296
crdKind := "ConversionTest"
292
297
verifyCAInjection = func (g Gomega ) {
293
- crdOutput , err := kbc .Kubectl .Get (
298
+ var crdOutput string
299
+ crdOutput , err = kbc .Kubectl .Get (
294
300
false ,
295
301
"customresourcedefinition.apiextensions.k8s.io" ,
296
302
"-o" , fmt .Sprintf (
@@ -366,7 +372,7 @@ func Run(kbc *utils.TestContext, hasWebhook, isToUseInstaller, isToUseHelmChart,
366
372
By ("applying the CR in the created namespace" )
367
373
368
374
applySampleNamespaced := func (g Gomega ) {
369
- _ , err : = kbc .Kubectl .Apply (false , "-n" , namespace , "-f" , sampleFile )
375
+ _ , err = kbc .Kubectl .Apply (false , "-n" , namespace , "-f" , sampleFile )
370
376
g .Expect (err ).To (Not (HaveOccurred ()))
371
377
}
372
378
Eventually (applySampleNamespaced , 2 * time .Minute , time .Second ).Should (Succeed ())
@@ -493,7 +499,8 @@ func getMetricsOutput(kbc *utils.TestContext) string {
493
499
494
500
By ("ensuring the service endpoint is ready" )
495
501
checkServiceEndpoint := func (g Gomega ) {
496
- output , err := kbc .Kubectl .Get (
502
+ var output string
503
+ output , err = kbc .Kubectl .Get (
497
504
true ,
498
505
"endpoints" , fmt .Sprintf ("e2e-%s-controller-manager-metrics-service" , kbc .TestSuffix ),
499
506
"-o" , "jsonpath={.subsets[*].addresses[*].ip}" ,
@@ -511,7 +518,8 @@ func getMetricsOutput(kbc *utils.TestContext) string {
511
518
512
519
By ("validating that the curl pod is running as expected" )
513
520
verifyCurlUp := func (g Gomega ) {
514
- status , err := kbc .Kubectl .Get (
521
+ var status string
522
+ status , err = kbc .Kubectl .Get (
515
523
true ,
516
524
"pods" , "curl" , "-o" , "jsonpath={.status.phase}" )
517
525
g .Expect (err ).NotTo (HaveOccurred ())
0 commit comments