@@ -292,11 +292,18 @@ func handle() error {
292
292
}
293
293
}
294
294
295
+ normalizedVersion , err := getNormalizedVersion (* kubeVersion , * gkeClusterVer )
296
+ if err != nil {
297
+ return fmt .Errorf ("failed to get cluster minor version: %v" , err )
298
+ }
299
+
300
+ testSkip := generateTestSkip (normalizedVersion )
301
+
295
302
// Run the tests using the testDir kubernetes
296
303
if len (* storageClassFile ) != 0 {
297
- err = runCSITests (pkgDir , testDir , * testFocus , * storageClassFile , cloudProviderArgs , * deploymentStrat )
304
+ err = runCSITests (pkgDir , testDir , * testFocus , testSkip , * storageClassFile , cloudProviderArgs , * deploymentStrat )
298
305
} else if * migrationTest {
299
- err = runMigrationTests (pkgDir , testDir , * testFocus , cloudProviderArgs )
306
+ err = runMigrationTests (pkgDir , testDir , * testFocus , testSkip , cloudProviderArgs )
300
307
} else {
301
308
return fmt .Errorf ("did not run either CSI or Migration test" )
302
309
}
@@ -308,6 +315,31 @@ func handle() error {
308
315
return nil
309
316
}
310
317
318
+ func generateTestSkip (normalizedVersion string ) string {
319
+ skipString := "\\ [Disruptive\\ ]|\\ [Serial\\ ]|\\ [Feature:.+\\ ]"
320
+ switch normalizedVersion {
321
+ // Fall-through versioning since all test cases we want to skip in 1.15
322
+ // should also be skipped in 1.14
323
+ case "1.13" :
324
+ fallthrough
325
+ case "1.14" :
326
+ fallthrough
327
+ case "1.15" :
328
+ fallthrough
329
+ case "1.16" :
330
+ // "volumeMode should not mount / map unused volumes in a pod" tests a
331
+ // bug-fix introduced in 1.17
332
+ // (https://github.com/kubernetes/kubernetes/pull/81163)
333
+ skipString = skipString + "|volumeMode\\ sshould\\ snot\\ smount\\ s/\\ smap\\ sunused\\ svolumes\\ sin\\ sa\\ spod"
334
+ fallthrough
335
+ case "1.17" :
336
+ case "latest" :
337
+ case "master" :
338
+ default :
339
+ }
340
+ return skipString
341
+ }
342
+
311
343
func setEnvProject (project string ) error {
312
344
out , err := exec .Command ("gcloud" , "config" , "set" , "project" , project ).CombinedOutput ()
313
345
if err != nil {
@@ -321,20 +353,20 @@ func setEnvProject(project string) error {
321
353
return nil
322
354
}
323
355
324
- func runMigrationTests (pkgDir , testDir , testFocus string , cloudProviderArgs []string ) error {
325
- return runTestsWithConfig (testDir , testFocus , "--storage.migratedPlugins=kubernetes.io/gce-pd" , cloudProviderArgs )
356
+ func runMigrationTests (pkgDir , testDir , testFocus , testSkip string , cloudProviderArgs []string ) error {
357
+ return runTestsWithConfig (testDir , testFocus , testSkip , "--storage.migratedPlugins=kubernetes.io/gce-pd" , cloudProviderArgs )
326
358
}
327
359
328
- func runCSITests (pkgDir , testDir , testFocus , storageClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
360
+ func runCSITests (pkgDir , testDir , testFocus , testSkip , storageClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
329
361
testDriverConfigFile , err := generateDriverConfigFile (pkgDir , storageClassFile , deploymentStrat )
330
362
if err != nil {
331
363
return err
332
364
}
333
365
testConfigArg := fmt .Sprintf ("--storage.testdriver=%s" , testDriverConfigFile )
334
- return runTestsWithConfig (testDir , testFocus , testConfigArg , cloudProviderArgs )
366
+ return runTestsWithConfig (testDir , testFocus , testSkip , testConfigArg , cloudProviderArgs )
335
367
}
336
368
337
- func runTestsWithConfig (testDir , testFocus , testConfigArg string , cloudProviderArgs []string ) error {
369
+ func runTestsWithConfig (testDir , testFocus , testSkip , testConfigArg string , cloudProviderArgs []string ) error {
338
370
err := os .Chdir (testDir )
339
371
if err != nil {
340
372
return err
@@ -348,7 +380,7 @@ func runTestsWithConfig(testDir, testFocus, testConfigArg string, cloudProviderA
348
380
349
381
testArgs := fmt .Sprintf ("--ginkgo.focus=%s --ginkgo.skip=%s %s %s" ,
350
382
testFocus ,
351
- " \\ [Disruptive \\ ]| \\ [Serial \\ ]| \\ [Feature:.+ \\ ]" ,
383
+ testSkip ,
352
384
testConfigArg ,
353
385
reportArg )
354
386
0 commit comments