@@ -20,6 +20,7 @@ import (
20
20
"os"
21
21
"os/exec"
22
22
"path/filepath"
23
+ "strings"
23
24
"syscall"
24
25
25
26
"k8s.io/apimachinery/pkg/util/uuid"
33
34
teardownCluster = flag .Bool ("teardown-cluster" , true , "teardown the cluster after the e2e test" )
34
35
teardownDriver = flag .Bool ("teardown-driver" , true , "teardown the driver after the e2e test" )
35
36
bringupCluster = flag .Bool ("bringup-cluster" , true , "build kubernetes and bringup a cluster" )
37
+ platform = flag .String ("platform" , "linux" , "platform that the tests will be run, either linux or windows" )
36
38
gceZone = flag .String ("gce-zone" , "" , "zone that the gce k8s cluster is created/found in" )
37
39
gceRegion = flag .String ("gce-region" , "" , "region that gke regional cluster should be created in" )
38
40
kubeVersion = flag .String ("kube-version" , "" , "version of Kubernetes to download and use for the cluster" )
@@ -157,26 +159,27 @@ func handle() error {
157
159
158
160
// If running in Prow, then acquire and set up a project through Boskos
159
161
if * inProw {
160
- project , _ := testutils .SetupProwConfig (* boskosResourceType )
161
-
162
162
oldProject , err := exec .Command ("gcloud" , "config" , "get-value" , "project" ).CombinedOutput ()
163
+ * stagingImage = fmt .Sprintf ("gcr.io/%s/gcp-persistent-disk-csi-driver" , strings .TrimSpace (string (oldProject )))
163
164
if err != nil {
164
165
return fmt .Errorf ("failed to get gcloud project: %s, err: %v" , oldProject , err )
165
166
}
166
-
167
- err = setEnvProject (project )
168
- if err != nil {
169
- return fmt .Errorf ("failed to set project environment to %s: %v" , project , err )
170
- }
171
- defer func () {
172
- err = setEnvProject (string (oldProject ))
167
+ if * platform != "windows" {
168
+ project , _ := testutils .SetupProwConfig (* boskosResourceType )
169
+ err = setEnvProject (project )
173
170
if err != nil {
174
- klog .Errorf ("failed to set project environment to %s: %v" , oldProject , err )
171
+ return fmt .Errorf ("failed to set project environment to %s: %v" , project , err )
172
+ }
173
+ if * doDriverBuild {
174
+ * stagingImage = fmt .Sprintf ("gcr.io/%s/gcp-persistent-disk-csi-driver" , strings .TrimSpace (string (project )))
175
175
}
176
- }()
177
176
178
- if * doDriverBuild {
179
- * stagingImage = fmt .Sprintf ("gcr.io/%s/gcp-persistent-disk-csi-driver" , project )
177
+ defer func () {
178
+ err = setEnvProject (string (oldProject ))
179
+ if err != nil {
180
+ klog .Errorf ("failed to set project environment to %s: %v" , oldProject , err )
181
+ }
182
+ }()
180
183
}
181
184
182
185
if _ , ok := os .LookupEnv ("USER" ); ! ok {
@@ -189,7 +192,7 @@ func handle() error {
189
192
190
193
// Build and push the driver, if required. Defer the driver image deletion.
191
194
if * doDriverBuild {
192
- err := pushImage (pkgDir , * stagingImage , stagingVersion )
195
+ err := pushImage (pkgDir , * stagingImage , stagingVersion , * platform )
193
196
if err != nil {
194
197
return fmt .Errorf ("failed pushing image: %v" , err )
195
198
}
@@ -319,7 +322,7 @@ func handle() error {
319
322
var testSkip string
320
323
switch * deploymentStrat {
321
324
case "gce" :
322
- testSkip = generateGCETestSkip (clusterVersion )
325
+ testSkip = generateGCETestSkip (clusterVersion , * platform )
323
326
case "gke" :
324
327
testSkip = generateGKETestSkip (clusterVersion , * useGKEManagedDriver )
325
328
default :
@@ -328,7 +331,7 @@ func handle() error {
328
331
329
332
// Run the tests using the testDir kubernetes
330
333
if len (* storageClassFile ) != 0 {
331
- err = runCSITests (pkgDir , testDir , * testFocus , testSkip , * storageClassFile , * snapshotClassFile , cloudProviderArgs , * deploymentStrat )
334
+ err = runCSITests (* platform , pkgDir , testDir , * testFocus , testSkip , * storageClassFile , * snapshotClassFile , cloudProviderArgs , * deploymentStrat )
332
335
} else if * migrationTest {
333
336
err = runMigrationTests (pkgDir , testDir , * testFocus , testSkip , cloudProviderArgs )
334
337
} else {
@@ -342,7 +345,7 @@ func handle() error {
342
345
return nil
343
346
}
344
347
345
- func generateGCETestSkip (clusterVersion string ) string {
348
+ func generateGCETestSkip (clusterVersion , platform string ) string {
346
349
skipString := "\\ [Disruptive\\ ]|\\ [Serial\\ ]"
347
350
v := apimachineryversion .MustParseSemantic (clusterVersion )
348
351
@@ -352,10 +355,12 @@ func generateGCETestSkip(clusterVersion string) string {
352
355
if v .LessThan (apimachineryversion .MustParseSemantic ("1.16.0" )) {
353
356
skipString = skipString + "|volumeMode\\ sshould\\ snot\\ smount\\ s/\\ smap\\ sunused\\ svolumes\\ sin\\ sa\\ spod"
354
357
}
355
-
356
358
if v .LessThan (apimachineryversion .MustParseSemantic ("1.17.0" )) {
357
359
skipString = skipString + "|VolumeSnapshotDataSource"
358
360
}
361
+ if platform == "windows" {
362
+ skipString = skipString + "|\\ [LinuxOnly\\ ]|\\ [Feature:.+\\ ][Ephemeral]"
363
+ }
359
364
return skipString
360
365
}
361
366
@@ -375,7 +380,6 @@ func generateGKETestSkip(clusterVersion string, use_gke_managed_driver bool) str
375
380
(! use_gke_managed_driver && (* curVer ).lessThan (mustParseVersion ("1.17.0" ))) {
376
381
skipString = skipString + "|VolumeSnapshotDataSource"
377
382
}
378
-
379
383
return skipString
380
384
}
381
385
@@ -396,8 +400,8 @@ func runMigrationTests(pkgDir, testDir, testFocus, testSkip string, cloudProvide
396
400
return runTestsWithConfig (testDir , testFocus , testSkip , "--storage.migratedPlugins=kubernetes.io/gce-pd" , cloudProviderArgs )
397
401
}
398
402
399
- func runCSITests (pkgDir , testDir , testFocus , testSkip , storageClassFile , snapshotClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
400
- testDriverConfigFile , err := generateDriverConfigFile (pkgDir , storageClassFile , snapshotClassFile , deploymentStrat )
403
+ func runCSITests (platform , pkgDir , testDir , testFocus , testSkip , storageClassFile , snapshotClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
404
+ testDriverConfigFile , err := generateDriverConfigFile (platform , pkgDir , storageClassFile , snapshotClassFile , deploymentStrat )
401
405
if err != nil {
402
406
return err
403
407
}
@@ -419,10 +423,12 @@ func runTestsWithConfig(testDir, testFocus, testSkip, testConfigArg string, clou
419
423
if ok {
420
424
reportArg = fmt .Sprintf ("-report-dir=%s" , artifactsDir )
421
425
}
422
-
423
- testArgs := fmt .Sprintf ("--ginkgo.focus=%s --ginkgo.skip=%s %s %s" ,
424
- testFocus ,
425
- testSkip ,
426
+ ginkgoArgs := fmt .Sprintf ("--ginkgo.focus=%s --ginkgo.skip=%s" , testFocus , testSkip )
427
+ if * platform == "windows" {
428
+ ginkgoArgs = ginkgoArgs + fmt .Sprintf (" --node-os-distro=%s" , * platform )
429
+ }
430
+ testArgs := fmt .Sprintf ("%s %s %s" ,
431
+ ginkgoArgs ,
426
432
testConfigArg ,
427
433
reportArg )
428
434
@@ -432,7 +438,6 @@ func runTestsWithConfig(testDir, testFocus, testSkip, testConfigArg string, clou
432
438
"--check-version-skew=false" ,
433
439
fmt .Sprintf ("--test_args=%s" , testArgs ),
434
440
}
435
-
436
441
kubeTestArgs = append (kubeTestArgs , cloudProviderArgs ... )
437
442
438
443
err = runCommand ("Running Tests" , exec .Command ("kubetest" , kubeTestArgs ... ))
0 commit comments