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