@@ -286,95 +286,99 @@ func FailfWithOffset(offset int, format string, args ...interface{}) {
286
286
ginkgowrapper .Fail (nowStamp ()+ ": " + msg , 1 + offset )
287
287
}
288
288
289
- func Skipf ( format string , args ... interface {}) {
289
+ func skipInternalf ( caller int , format string , args ... interface {}) {
290
290
msg := fmt .Sprintf (format , args ... )
291
291
log ("INFO" , msg )
292
- ginkgowrapper .Skip (nowStamp () + ": " + msg )
292
+ ginkgowrapper .Skip (msg , caller + 1 )
293
+ }
294
+
295
+ func Skipf (format string , args ... interface {}) {
296
+ skipInternalf (1 , format , args ... )
293
297
}
294
298
295
299
func SkipUnlessNodeCountIsAtLeast (minNodeCount int ) {
296
300
if TestContext .CloudConfig .NumNodes < minNodeCount {
297
- Skipf ( "Requires at least %d nodes (not %d)" , minNodeCount , TestContext .CloudConfig .NumNodes )
301
+ skipInternalf ( 1 , "Requires at least %d nodes (not %d)" , minNodeCount , TestContext .CloudConfig .NumNodes )
298
302
}
299
303
}
300
304
301
305
func SkipUnlessNodeCountIsAtMost (maxNodeCount int ) {
302
306
if TestContext .CloudConfig .NumNodes > maxNodeCount {
303
- Skipf ( "Requires at most %d nodes (not %d)" , maxNodeCount , TestContext .CloudConfig .NumNodes )
307
+ skipInternalf ( 1 , "Requires at most %d nodes (not %d)" , maxNodeCount , TestContext .CloudConfig .NumNodes )
304
308
}
305
309
}
306
310
307
311
func SkipUnlessAtLeast (value int , minValue int , message string ) {
308
312
if value < minValue {
309
- Skipf ( message )
313
+ skipInternalf ( 1 , message )
310
314
}
311
315
}
312
316
313
317
func SkipIfProviderIs (unsupportedProviders ... string ) {
314
318
if ProviderIs (unsupportedProviders ... ) {
315
- Skipf ( "Not supported for providers %v (found %s)" , unsupportedProviders , TestContext .Provider )
319
+ skipInternalf ( 1 , "Not supported for providers %v (found %s)" , unsupportedProviders , TestContext .Provider )
316
320
}
317
321
}
318
322
319
323
func SkipUnlessLocalEphemeralStorageEnabled () {
320
324
if ! utilfeature .DefaultFeatureGate .Enabled (features .LocalStorageCapacityIsolation ) {
321
- Skipf ( "Only supported when %v feature is enabled" , features .LocalStorageCapacityIsolation )
325
+ skipInternalf ( 1 , "Only supported when %v feature is enabled" , features .LocalStorageCapacityIsolation )
322
326
}
323
327
}
324
328
325
329
func SkipUnlessSSHKeyPresent () {
326
330
if _ , err := GetSigner (TestContext .Provider ); err != nil {
327
- Skipf ( "No SSH Key for provider %s: '%v'" , TestContext .Provider , err )
331
+ skipInternalf ( 1 , "No SSH Key for provider %s: '%v'" , TestContext .Provider , err )
328
332
}
329
333
}
330
334
331
335
func SkipUnlessProviderIs (supportedProviders ... string ) {
332
336
if ! ProviderIs (supportedProviders ... ) {
333
- Skipf ( "Only supported for providers %v (not %s)" , supportedProviders , TestContext .Provider )
337
+ skipInternalf ( 1 , "Only supported for providers %v (not %s)" , supportedProviders , TestContext .Provider )
334
338
}
335
339
}
336
340
337
341
func SkipUnlessMultizone (c clientset.Interface ) {
338
342
zones , err := GetClusterZones (c )
339
343
if err != nil {
340
- Skipf ( "Error listing cluster zones" )
344
+ skipInternalf ( 1 , "Error listing cluster zones" )
341
345
}
342
346
if zones .Len () <= 1 {
343
- Skipf ( "Requires more than one zone" )
347
+ skipInternalf ( 1 , "Requires more than one zone" )
344
348
}
345
349
}
346
350
347
351
func SkipIfMultizone (c clientset.Interface ) {
348
352
zones , err := GetClusterZones (c )
349
353
if err != nil {
350
- Skipf ( "Error listing cluster zones" )
354
+ skipInternalf ( 1 , "Error listing cluster zones" )
351
355
}
352
356
if zones .Len () > 1 {
353
- Skipf ( "Requires at most one zone" )
357
+ skipInternalf ( 1 , "Requires at most one zone" )
354
358
}
355
359
}
356
360
357
361
func SkipUnlessClusterMonitoringModeIs (supportedMonitoring ... string ) {
358
362
if ! ClusterMonitoringModeIs (supportedMonitoring ... ) {
359
- Skipf ( "Only next monitoring modes are supported %v (not %s)" , supportedMonitoring , TestContext .ClusterMonitoringMode )
363
+ skipInternalf ( 1 , "Only next monitoring modes are supported %v (not %s)" , supportedMonitoring , TestContext .ClusterMonitoringMode )
360
364
}
361
365
}
362
366
363
367
func SkipUnlessPrometheusMonitoringIsEnabled (supportedMonitoring ... string ) {
364
368
if ! TestContext .EnablePrometheusMonitoring {
365
- Skipf ( "Skipped because prometheus monitoring is not enabled" )
369
+ skipInternalf ( 1 , "Skipped because prometheus monitoring is not enabled" )
366
370
}
367
371
}
368
372
369
373
func SkipUnlessMasterOSDistroIs (supportedMasterOsDistros ... string ) {
370
374
if ! MasterOSDistroIs (supportedMasterOsDistros ... ) {
371
- Skipf ( "Only supported for master OS distro %v (not %s)" , supportedMasterOsDistros , TestContext .MasterOSDistro )
375
+ skipInternalf ( 1 , "Only supported for master OS distro %v (not %s)" , supportedMasterOsDistros , TestContext .MasterOSDistro )
372
376
}
373
377
}
374
378
375
379
func SkipUnlessNodeOSDistroIs (supportedNodeOsDistros ... string ) {
376
380
if ! NodeOSDistroIs (supportedNodeOsDistros ... ) {
377
- Skipf ( "Only supported for node OS distro %v (not %s)" , supportedNodeOsDistros , TestContext .NodeOSDistro )
381
+ skipInternalf ( 1 , "Only supported for node OS distro %v (not %s)" , supportedNodeOsDistros , TestContext .NodeOSDistro )
378
382
}
379
383
}
380
384
@@ -389,21 +393,21 @@ func SkipUnlessSecretExistsAfterWait(c clientset.Interface, name, namespace stri
389
393
}
390
394
return true , nil
391
395
}) != nil {
392
- Skipf ( "Secret %v in namespace %v did not exist after timeout of %v" , name , namespace , timeout )
396
+ skipInternalf ( 1 , "Secret %v in namespace %v did not exist after timeout of %v" , name , namespace , timeout )
393
397
}
394
398
Logf ("Secret %v in namespace %v found after duration %v" , name , namespace , time .Since (start ))
395
399
}
396
400
397
401
func SkipUnlessTaintBasedEvictionsEnabled () {
398
402
if ! utilfeature .DefaultFeatureGate .Enabled (features .TaintBasedEvictions ) {
399
- Skipf ( "Only supported when %v feature is enabled" , features .TaintBasedEvictions )
403
+ skipInternalf ( 1 , "Only supported when %v feature is enabled" , features .TaintBasedEvictions )
400
404
}
401
405
}
402
406
403
407
func SkipIfContainerRuntimeIs (runtimes ... string ) {
404
408
for _ , runtime := range runtimes {
405
409
if runtime == TestContext .ContainerRuntime {
406
- Skipf ( "Not supported under container runtime %s" , runtime )
410
+ skipInternalf ( 1 , "Not supported under container runtime %s" , runtime )
407
411
}
408
412
}
409
413
}
@@ -414,7 +418,7 @@ func RunIfContainerRuntimeIs(runtimes ...string) {
414
418
return
415
419
}
416
420
}
417
- Skipf ( "Skipped because container runtime %q is not in %s" , TestContext .ContainerRuntime , runtimes )
421
+ skipInternalf ( 1 , "Skipped because container runtime %q is not in %s" , TestContext .ContainerRuntime , runtimes )
418
422
}
419
423
420
424
func RunIfSystemSpecNameIs (names ... string ) {
@@ -423,7 +427,7 @@ func RunIfSystemSpecNameIs(names ...string) {
423
427
return
424
428
}
425
429
}
426
- Skipf ( "Skipped because system spec name %q is not in %v" , TestContext .SystemSpecName , names )
430
+ skipInternalf ( 1 , "Skipped because system spec name %q is not in %v" , TestContext .SystemSpecName , names )
427
431
}
428
432
429
433
func ProviderIs (providers ... string ) bool {
@@ -497,7 +501,7 @@ func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersio
497
501
Failf ("Failed to get server version: %v" , err )
498
502
}
499
503
if ! gte {
500
- Skipf ( "Not supported for server versions before %q" , v )
504
+ skipInternalf ( 1 , "Not supported for server versions before %q" , v )
501
505
}
502
506
}
503
507
@@ -507,7 +511,7 @@ func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVers
507
511
if err != nil {
508
512
// not all resources support list, so we ignore those
509
513
if apierrs .IsMethodNotSupported (err ) || apierrs .IsNotFound (err ) || apierrs .IsForbidden (err ) {
510
- Skipf ( "Could not find %s resource, skipping test: %#v" , gvr , err )
514
+ skipInternalf ( 1 , "Could not find %s resource, skipping test: %#v" , gvr , err )
511
515
}
512
516
Failf ("Unexpected error getting %v: %v" , gvr , err )
513
517
}
@@ -1943,7 +1947,7 @@ func SkipUnlessKubectlVersionGTE(v *utilversion.Version) {
1943
1947
Failf ("Failed to get kubectl version: %v" , err )
1944
1948
}
1945
1949
if ! gte {
1946
- Skipf ( "Not supported for kubectl versions before %q" , v )
1950
+ skipInternalf ( 1 , "Not supported for kubectl versions before %q" , v )
1947
1951
}
1948
1952
}
1949
1953
0 commit comments