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