43
43
doDriverBuild = flag .Bool ("do-driver-build" , true , "building the driver from source" )
44
44
boskosResourceType = flag .String ("boskos-resource-type" , "gce-project" , "name of the boskos resource type to reserve" )
45
45
storageClassFile = flag .String ("storageclass-file" , "" , "name of storageclass yaml file to use for test relative to test/k8s-integration/config" )
46
+ kubeFeatureGates = flag .String ("kube-feature-gates" , "" , "feature gates to set on new kubernetes cluster" )
47
+ testFocus = flag .String ("test-focus" , "" , "test focus for Kubernetes e2e" )
46
48
)
47
49
48
50
const (
@@ -72,6 +74,14 @@ func main() {
72
74
glog .Fatalf ("storageclass-file is a required flag" )
73
75
}
74
76
77
+ if ! * bringupCluster && len (* kubeFeatureGates ) > 0 {
78
+ glog .Fatalf ("kube-feature-gates set but not bringing up new cluster" )
79
+ }
80
+
81
+ if len (* testFocus ) == 0 {
82
+ glog .Fatalf ("test-focus is a required flag" )
83
+ }
84
+
75
85
err := handle ()
76
86
if err != nil {
77
87
glog .Fatalf ("Failed to run integration test: %v" , err )
@@ -161,6 +171,14 @@ func handle() error {
161
171
glog .Errorf ("could not find cluster kubectl at %s, falling back to default kubectl" , kshPath )
162
172
}
163
173
174
+ if len (* kubeFeatureGates ) != 0 {
175
+ err = os .Setenv ("KUBE_FEATURE_GATES" , * kubeFeatureGates )
176
+ if err != nil {
177
+ return fmt .Errorf ("failed to set kubernetes feature gates: %v" , err )
178
+ }
179
+ glog .V (4 ).Infof ("Set Kubernetes feature gates: %v" , * kubeFeatureGates )
180
+ }
181
+
164
182
err = clusterUp (k8sDir )
165
183
if err != nil {
166
184
return fmt .Errorf ("failed to cluster up: %v" , err )
@@ -192,7 +210,7 @@ func handle() error {
192
210
if len (* localK8sDir ) != 0 {
193
211
k8sDir = * localK8sDir
194
212
}
195
- err = runTests (pkgDir , k8sDir , * storageClassFile )
213
+ err = runTests (pkgDir , k8sDir , * storageClassFile , * testFocus )
196
214
if err != nil {
197
215
return fmt .Errorf ("failed to run tests: %v" , err )
198
216
}
@@ -213,7 +231,7 @@ func setEnvProject(project string) error {
213
231
return nil
214
232
}
215
233
216
- func runTests (pkgDir , k8sDir , storageClassFile string ) error {
234
+ func runTests (pkgDir , k8sDir , storageClassFile , testFocus string ) error {
217
235
testDriverConfigFile , err := generateDriverConfigFile (pkgDir , storageClassFile )
218
236
if err != nil {
219
237
return err
@@ -231,10 +249,11 @@ func runTests(pkgDir, k8sDir, storageClassFile string) error {
231
249
reportArg := fmt .Sprintf ("-report-dir=%s" , artifactsDir )
232
250
233
251
driverConfigArg := fmt .Sprintf ("-storage.testdriver=%s" , testDriverConfigFile )
252
+ testFocusArg := fmt .Sprintf ("-focus=%s" , testFocus )
234
253
235
254
cmd := exec .Command (filepath .Join (k8sBuildBinDir , "ginkgo" ),
236
255
"-p" ,
237
- "-focus=External.Storage" ,
256
+ testFocusArg ,
238
257
"-skip=\\ [Disruptive\\ ]|\\ [Serial\\ ]|\\ [Feature:.+\\ ]" ,
239
258
filepath .Join (k8sBuildBinDir , "e2e.test" ),
240
259
"--" ,
0 commit comments