@@ -216,10 +216,16 @@ func handle() error {
216
216
if err != nil {
217
217
return fmt .Errorf ("failed to build Kubernetes: %v" , err )
218
218
}
219
+ err = buildKubernetes (testDir , "ginkgo" )
220
+ if err != nil {
221
+ return fmt .Errorf ("failed to build gingko: %v" , err )
222
+ }
219
223
} else {
220
224
testDir = k8sDir
221
225
}
222
226
227
+ var cloudProviderArgs []string
228
+
223
229
// Create a cluster either through GKE or GCE
224
230
if * bringupCluster {
225
231
var err error = nil
@@ -228,6 +234,10 @@ func handle() error {
228
234
err = clusterUpGCE (k8sDir , * gceZone , * numNodes )
229
235
case "gke" :
230
236
err = clusterUpGKE (* gceZone , * numNodes )
237
+ cloudProviderArgs , err = getGKEKubeTestArgs ()
238
+ if err != nil {
239
+ return fmt .Errorf ("failed to build GKE kubetest args: %v" , err )
240
+ }
231
241
default :
232
242
err = fmt .Errorf ("deployment-strategy must be set to 'gce' or 'gke', but is: %s" , * deploymentStrat )
233
243
}
@@ -272,9 +282,9 @@ func handle() error {
272
282
273
283
// Run the tests using the testDir kubernetes
274
284
if len (* storageClassFile ) != 0 {
275
- err = runCSITests (pkgDir , testDir , * testFocus , * storageClassFile )
285
+ err = runCSITests (pkgDir , testDir , * testFocus , * storageClassFile , cloudProviderArgs )
276
286
} else if * migrationTest {
277
- err = runMigrationTests (pkgDir , testDir , * testFocus )
287
+ err = runMigrationTests (pkgDir , testDir , * testFocus , cloudProviderArgs )
278
288
} else {
279
289
return fmt .Errorf ("did not run either CSI or Migration test" )
280
290
}
@@ -299,20 +309,20 @@ func setEnvProject(project string) error {
299
309
return nil
300
310
}
301
311
302
- func runMigrationTests (pkgDir , testDir , testFocus string ) error {
303
- return runTestsWithConfig (testDir , testFocus , "--storage.migratedPlugins=kubernetes.io/gce-pd" )
312
+ func runMigrationTests (pkgDir , testDir , testFocus string , cloudProviderArgs [] string ) error {
313
+ return runTestsWithConfig (testDir , testFocus , "--storage.migratedPlugins=kubernetes.io/gce-pd" , cloudProviderArgs )
304
314
}
305
315
306
- func runCSITests (pkgDir , testDir , testFocus , storageClassFile string ) error {
316
+ func runCSITests (pkgDir , testDir , testFocus , storageClassFile string , cloudProviderArgs [] string ) error {
307
317
testDriverConfigFile , err := generateDriverConfigFile (pkgDir , storageClassFile )
308
318
if err != nil {
309
319
return err
310
320
}
311
321
testConfigArg := fmt .Sprintf ("--storage.testdriver=%s" , testDriverConfigFile )
312
- return runTestsWithConfig (testDir , testFocus , testConfigArg )
322
+ return runTestsWithConfig (testDir , testFocus , testConfigArg , cloudProviderArgs )
313
323
}
314
324
315
- func runTestsWithConfig (testDir , testFocus , testConfigArg string ) error {
325
+ func runTestsWithConfig (testDir , testFocus , testConfigArg string , cloudProviderArgs [] string ) error {
316
326
err := os .Chdir (testDir )
317
327
if err != nil {
318
328
return err
@@ -324,18 +334,21 @@ func runTestsWithConfig(testDir, testFocus, testConfigArg string) error {
324
334
artifactsDir , _ := os .LookupEnv ("ARTIFACTS" )
325
335
reportArg := fmt .Sprintf ("-report-dir=%s" , artifactsDir )
326
336
327
- kubetestArgs := fmt .Sprintf ("--ginkgo.focus=%s --ginkgo.skip=%s %s %s" ,
337
+ testArgs := fmt .Sprintf ("--ginkgo.focus=%s --ginkgo.skip=%s %s %s" ,
328
338
testFocus ,
329
339
"\\ [Disruptive\\ ]|\\ [Serial\\ ]|\\ [Feature:.+\\ ]" ,
330
340
testConfigArg ,
331
341
reportArg )
332
342
333
- cmd := exec . Command ( "kubetest" ,
343
+ kubeTestArgs := [] string {
334
344
"--test" ,
335
345
"--ginkgo-parallel" ,
336
- fmt .Sprintf ("--test_args=%s" , kubetestArgs ),
337
- )
338
- err = runCommand ("Running Tests" , cmd )
346
+ fmt .Sprintf ("--test_args=%s" , testArgs ),
347
+ }
348
+
349
+ kubeTestArgs = append (kubeTestArgs , cloudProviderArgs ... )
350
+
351
+ err = runCommand ("Running Tests" , exec .Command ("kubetest" , kubeTestArgs ... ))
339
352
if err != nil {
340
353
return fmt .Errorf ("failed to run tests on e2e cluster: %v" , err )
341
354
}
0 commit comments