@@ -87,7 +87,7 @@ type testParameters struct {
87
87
goPath string
88
88
pkgDir string
89
89
testParentDir string
90
- testDir string
90
+ k8sSourceDir string
91
91
testFocus string
92
92
testSkip string
93
93
snapshotClassFile string
@@ -264,41 +264,42 @@ func handle() error {
264
264
265
265
// Create temporary directories for kubernetes builds
266
266
testParams .testParentDir = generateUniqueTmpDir ()
267
- testParams .testDir = filepath .Join (testParams .testParentDir , "kubernetes" )
268
267
defer removeDir (testParams .testParentDir )
269
268
270
269
// If kube version is set, then download and build Kubernetes for cluster creation
271
270
// Otherwise, either GKE or a prebuild local K8s dir is being used
272
271
if len (* kubeVersion ) != 0 {
272
+ testParams .k8sSourceDir = filepath .Join (testParams .testParentDir , "kubernetes" )
273
273
err := downloadKubernetesSource (testParams .pkgDir , testParams .testParentDir , * kubeVersion )
274
274
if err != nil {
275
275
return fmt .Errorf ("failed to download Kubernetes source: %v" , err )
276
276
}
277
- err = buildKubernetes (testParams .testDir , "quick-release" )
277
+ err = buildKubernetes (testParams .k8sSourceDir , "quick-release" )
278
278
if err != nil {
279
279
return fmt .Errorf ("failed to build Kubernetes: %v" , err )
280
280
}
281
281
} else {
282
- testParams .testDir = * localK8sDir
282
+ testParams .k8sSourceDir = * localK8sDir
283
283
}
284
284
285
285
// If test version is set, then download and build Kubernetes to run K8s tests
286
286
// Otherwise, either kube version is set (which implies GCE) or a local K8s dir is being used
287
287
if len (* testVersion ) != 0 && * testVersion != * kubeVersion {
288
+ testParams .k8sSourceDir = filepath .Join (testParams .testParentDir , "kubernetes" )
288
289
err := downloadKubernetesSource (testParams .pkgDir , testParams .testParentDir , * testVersion )
289
290
if err != nil {
290
291
return fmt .Errorf ("failed to download Kubernetes source: %v" , err )
291
292
}
292
- err = buildKubernetes (testParams .testDir , "WHAT=test/e2e/e2e.test" )
293
+ err = buildKubernetes (testParams .k8sSourceDir , "WHAT=test/e2e/e2e.test" )
293
294
if err != nil {
294
295
return fmt .Errorf ("failed to build Kubernetes e2e: %v" , err )
295
296
}
296
297
// kubetest relies on ginkgo and kubectl already built in the test k8s directory
297
- err = buildKubernetes (testParams .testDir , "ginkgo" )
298
+ err = buildKubernetes (testParams .k8sSourceDir , "ginkgo" )
298
299
if err != nil {
299
300
return fmt .Errorf ("failed to build gingko: %v" , err )
300
301
}
301
- err = buildKubernetes (testParams .testDir , "kubectl" )
302
+ err = buildKubernetes (testParams .k8sSourceDir , "kubectl" )
302
303
if err != nil {
303
304
return fmt .Errorf ("failed to build kubectl: %v" , err )
304
305
}
@@ -317,7 +318,7 @@ func handle() error {
317
318
var err error = nil
318
319
switch * deploymentStrat {
319
320
case "gce" :
320
- err = clusterUpGCE (testParams .testDir , * gceZone , * numNodes , testParams .imageType )
321
+ err = clusterUpGCE (testParams .k8sSourceDir , * gceZone , * numNodes , testParams .imageType )
321
322
case "gke" :
322
323
err = clusterUpGKE (* gceZone , * gceRegion , * numNodes , testParams .imageType , testParams .useGKEManagedDriver )
323
324
default :
@@ -333,7 +334,7 @@ func handle() error {
333
334
defer func () {
334
335
switch testParams .deploymentStrategy {
335
336
case "gce" :
336
- err := clusterDownGCE (testParams .testDir )
337
+ err := clusterDownGCE (testParams .k8sSourceDir )
337
338
if err != nil {
338
339
klog .Errorf ("failed to cluster down: %v" , err )
339
340
}
@@ -449,7 +450,7 @@ func handle() error {
449
450
// If --legacy-mode is set, kubernetes/kubernetes is used;
450
451
// otherwise kubernetes/cloud-provider-gcp is used.
451
452
"--legacy-mode" ,
452
- fmt .Sprintf ("--repo-root=%s" , * localK8sDir ),
453
+ fmt .Sprintf ("--repo-root=%s" , testParams . k8sSourceDir ),
453
454
}
454
455
}
455
456
}
@@ -470,7 +471,7 @@ func handle() error {
470
471
return fmt .Errorf ("Unknown deployment strategy %s" , testParams .deploymentStrategy )
471
472
}
472
473
473
- // Run the tests using the testDir kubernetes
474
+ // Run the tests using the k8sSourceDir kubernetes
474
475
if len (* storageClassFiles ) != 0 {
475
476
applicableStorageClassFiles := []string {}
476
477
for _ , rawScFile := range strings .Split (* storageClassFiles , "," ) {
@@ -607,7 +608,7 @@ func runCSITests(testParams *testParameters, storageClassFile string, reportPref
607
608
}
608
609
609
610
func runTestsWithConfig (testParams * testParameters , testConfigArg , reportPrefix string ) error {
610
- err := os .Chdir (testParams .testDir )
611
+ err := os .Chdir (testParams .k8sSourceDir )
611
612
if err != nil {
612
613
return err
613
614
}
0 commit comments