@@ -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
testutils "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e/utils"
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" )
@@ -74,7 +76,6 @@ func init() {
74
76
75
77
func main () {
76
78
flag .Parse ()
77
-
78
79
if ! * inProw {
79
80
ensureVariable (stagingImage , true , "staging-image is a required flag, please specify the name of image to stage to" )
80
81
}
@@ -143,26 +144,26 @@ func handle() error {
143
144
144
145
// If running in Prow, then acquire and set up a project through Boskos
145
146
if * inProw {
146
- project , _ := testutils .SetupProwConfig (* boskosResourceType )
147
-
148
147
oldProject , err := exec .Command ("gcloud" , "config" , "get-value" , "project" ).CombinedOutput ()
149
148
if err != nil {
150
149
return fmt .Errorf ("failed to get gcloud project: %s, err: %v" , oldProject , err )
151
150
}
152
-
153
- err = setEnvProject (project )
154
- if err != nil {
155
- return fmt .Errorf ("failed to set project environment to %s: %v" , project , err )
156
- }
157
- defer func () {
158
- err = setEnvProject (string (oldProject ))
151
+ if * platform != "windows" {
152
+ project , _ := testutils .SetupProwConfig (* boskosResourceType )
153
+ err = setEnvProject (project )
159
154
if err != nil {
160
- klog .Errorf ("failed to set project environment to %s: %v" , oldProject , err )
155
+ return fmt .Errorf ("failed to set project environment to %s: %v" , project , err )
161
156
}
162
- }()
163
-
157
+ defer func () {
158
+ err = setEnvProject (string (oldProject ))
159
+ if err != nil {
160
+ klog .Errorf ("failed to set project environment to %s: %v" , oldProject , err )
161
+ }
162
+ }()
163
+ }
164
164
if * doDriverBuild {
165
- * stagingImage = fmt .Sprintf ("gcr.io/%s/gcp-persistent-disk-csi-driver" , project )
165
+ * stagingImage = fmt .Sprintf ("gcr.io/%s/gcp-persistent-disk-csi-driver" , strings .TrimSpace (string (oldProject )))
166
+ fmt .Printf ("stagingImage %s \n " , * stagingImage )
166
167
}
167
168
168
169
if _ , ok := os .LookupEnv ("USER" ); ! ok {
@@ -175,7 +176,7 @@ func handle() error {
175
176
176
177
// Build and push the driver, if required. Defer the driver image deletion.
177
178
if * doDriverBuild {
178
- err := pushImage (pkgDir , * stagingImage , stagingVersion )
179
+ err := pushImage (pkgDir , * stagingImage , stagingVersion , * platform )
179
180
if err != nil {
180
181
return fmt .Errorf ("failed pushing image: %v" , err )
181
182
}
@@ -295,15 +296,15 @@ func handle() error {
295
296
}
296
297
}
297
298
298
- normalizedVersion , err := getNormalizedVersion (* kubeVersion , * gkeClusterVer )
299
+ normalizedVersion , err := getNormalizedVersion ("master" , * gkeClusterVer )
299
300
if err != nil {
300
301
return fmt .Errorf ("failed to get cluster minor version: %v" , err )
301
302
}
302
303
303
- testSkip := generateTestSkip (normalizedVersion )
304
+ testSkip := generateTestSkip (normalizedVersion , * platform )
304
305
// Run the tests using the testDir kubernetes
305
306
if len (* storageClassFile ) != 0 {
306
- err = runCSITests (pkgDir , testDir , * testFocus , testSkip , * storageClassFile , * snapshotClassFile , cloudProviderArgs , * deploymentStrat )
307
+ err = runCSITests (* platform , pkgDir , testDir , * testFocus , testSkip , * storageClassFile , * snapshotClassFile , cloudProviderArgs , * deploymentStrat )
307
308
} else if * migrationTest {
308
309
err = runMigrationTests (pkgDir , testDir , * testFocus , testSkip , cloudProviderArgs )
309
310
} else {
@@ -317,7 +318,7 @@ func handle() error {
317
318
return nil
318
319
}
319
320
320
- func generateTestSkip (normalizedVersion string ) string {
321
+ func generateTestSkip (normalizedVersion , platform string ) string {
321
322
skipString := "\\ [Disruptive\\ ]|\\ [Serial\\ ]"
322
323
switch normalizedVersion {
323
324
// Fall-through versioning since all test cases we want to skip in 1.15
@@ -341,6 +342,9 @@ func generateTestSkip(normalizedVersion string) string {
341
342
case "master" :
342
343
default :
343
344
}
345
+ if platform == "windows" {
346
+ skipString = skipString + "|\\ [Slow\\ ]|\\ [LinuxOnly\\ ]|\\ [Feature:.+\\ ][Ephemeral]"
347
+ }
344
348
return skipString
345
349
}
346
350
@@ -361,8 +365,8 @@ func runMigrationTests(pkgDir, testDir, testFocus, testSkip string, cloudProvide
361
365
return runTestsWithConfig (testDir , testFocus , testSkip , "--storage.migratedPlugins=kubernetes.io/gce-pd" , cloudProviderArgs )
362
366
}
363
367
364
- func runCSITests (pkgDir , testDir , testFocus , testSkip , storageClassFile , snapshotClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
365
- testDriverConfigFile , err := generateDriverConfigFile (pkgDir , storageClassFile , snapshotClassFile , deploymentStrat )
368
+ func runCSITests (platform , pkgDir , testDir , testFocus , testSkip , storageClassFile , snapshotClassFile string , cloudProviderArgs []string , deploymentStrat string ) error {
369
+ testDriverConfigFile , err := generateDriverConfigFile (platform , pkgDir , storageClassFile , snapshotClassFile , deploymentStrat )
366
370
if err != nil {
367
371
return err
368
372
}
0 commit comments