@@ -14,6 +14,7 @@ import (
14
14
"github.com/onsi/ginkgo"
15
15
"github.com/onsi/ginkgo/config"
16
16
"github.com/onsi/ginkgo/reporters"
17
+ "github.com/onsi/ginkgo/types"
17
18
"github.com/onsi/gomega"
18
19
19
20
apierrs "k8s.io/apimachinery/pkg/api/errors"
@@ -53,7 +54,7 @@ func InitTest() {
53
54
54
55
e2e .RegisterCommonFlags ()
55
56
e2e .RegisterClusterFlags ()
56
- flag .StringVar (& syntheticSuite , "suite" , "" , "Optional suite selector to filter which tests are run." )
57
+ flag .StringVar (& syntheticSuite , "suite" , "" , "DEPRECATED: Optional suite selector to filter which tests are run. Use focus ." )
57
58
58
59
extendedOutputDir := filepath .Join (os .TempDir (), "openshift-extended-tests" )
59
60
os .MkdirAll (extendedOutputDir , 0777 )
@@ -103,16 +104,55 @@ func ExecuteTest(t *testing.T, suite string) {
103
104
defer e2e .CoreDump (reportDir )
104
105
}
105
106
106
- // Disable density test unless it's explicitly requested.
107
+ switch syntheticSuite {
108
+ case "parallel.conformance.openshift.io" :
109
+ if len (config .GinkgoConfig .FocusString ) > 0 {
110
+ config .GinkgoConfig .FocusString += "|"
111
+ }
112
+ config .GinkgoConfig .FocusString = "\\ [Suite:openshift/conformance/parallel\\ ]"
113
+ case "serial.conformance.openshift.io" :
114
+ if len (config .GinkgoConfig .FocusString ) > 0 {
115
+ config .GinkgoConfig .FocusString += "|"
116
+ }
117
+ config .GinkgoConfig .FocusString = "\\ [Suite:openshift/conformance/serial\\ ]"
118
+ }
107
119
if config .GinkgoConfig .FocusString == "" && config .GinkgoConfig .SkipString == "" {
108
120
config .GinkgoConfig .SkipString = "Skipped"
109
121
}
122
+
110
123
gomega .RegisterFailHandler (ginkgo .Fail )
111
124
112
125
if reportDir != "" {
113
126
r = append (r , reporters .NewJUnitReporter (path .Join (reportDir , fmt .Sprintf ("%s_%02d.xml" , reportFileName , config .GinkgoConfig .ParallelNode ))))
114
127
}
115
128
129
+ ginkgo .WalkTests (func (name string , node types.TestNode ) {
130
+ isSerial := serialTestsFilter .MatchString (name )
131
+ if isSerial {
132
+ if ! strings .Contains (name , "[Serial]" ) {
133
+ node .SetText (node .Text () + " [Serial]" )
134
+ }
135
+ }
136
+
137
+ if ! excludedTestsFilter .MatchString (name ) {
138
+ include := conformanceTestsFilter .MatchString (name )
139
+ switch {
140
+ case ! include :
141
+ // do nothing
142
+ case isSerial :
143
+ node .SetText (node .Text () + " [Suite:openshift/conformance/serial]" )
144
+ case include :
145
+ node .SetText (node .Text () + " [Suite:openshift/conformance/parallel]" )
146
+ }
147
+ }
148
+ if strings .Contains (node .CodeLocation ().FileName , "/origin/test/" ) && ! strings .Contains (node .Text (), "[Suite:openshift" ) {
149
+ node .SetText (node .Text () + " [Suite:openshift]" )
150
+ }
151
+ if strings .Contains (node .CodeLocation ().FileName , "/kubernetes/test/e2e/" ) {
152
+ node .SetText (node .Text () + " [Suite:k8s]" )
153
+ }
154
+ })
155
+
116
156
if quiet {
117
157
r = append (r , NewSimpleReporter ())
118
158
ginkgo .RunSpecsWithCustomReporters (t , suite , r )
@@ -210,7 +250,6 @@ func createTestingNS(baseName string, c kclientset.Interface, labels map[string]
210
250
var (
211
251
excludedTests = []string {
212
252
`\[Skipped\]` ,
213
- `\[Disruptive\]` ,
214
253
`\[Slow\]` ,
215
254
`\[Flaky\]` ,
216
255
`\[Compatibility\]` ,
@@ -311,7 +350,10 @@ var (
311
350
}
312
351
excludedTestsFilter = regexp .MustCompile (strings .Join (excludedTests , `|` ))
313
352
314
- parallelConformanceTests = []string {
353
+ // The list of tests to run for the OpenShift conformance suite. Any test
354
+ // in this group which cannot be run in parallel must be identified with the
355
+ // [Serial] tag or added to the serialTests filter.
356
+ conformanceTests = []string {
315
357
`\[Conformance\]` ,
316
358
`Services.*NodePort` ,
317
359
`ResourceQuota should` ,
@@ -327,7 +369,7 @@ var (
327
369
`Job should run a job to completion when tasks succeed` ,
328
370
`Variable Expansion` ,
329
371
`init containers` ,
330
- `Clean up pods on node kubelet` ,
372
+ `Clean up pods on node kubelet` , // often catches issues
331
373
`\[Feature\:SecurityContext\]` ,
332
374
`should create a LimitRange with defaults` ,
333
375
`Generated release_1_2 clientset` ,
@@ -336,46 +378,28 @@ var (
336
378
`ImageLookup` ,
337
379
`DNS for pods for Hostname and Subdomain Annotation` ,
338
380
}
339
- parallelConformanceTestsFilter = regexp .MustCompile (strings .Join (parallelConformanceTests , `|` ))
381
+ conformanceTestsFilter = regexp .MustCompile (strings .Join (conformanceTests , `|` ))
340
382
341
- serialConformanceTests = []string {
383
+ // Identifies any tests that by nature must be run in isolation. Every test in this
384
+ // category will be given the [Serial] tag if it does not already have it.
385
+ serialTests = []string {
342
386
`\[Serial\]` ,
387
+ `\[Disruptive\]` ,
343
388
`\[Feature:ManualPerformance\]` , // requires isolation
344
- `Service endpoints latency` , // requires low latency
345
389
`\[Feature:HighDensityPerformance\]` , // requires no other namespaces
346
- `Clean up pods on node` , // schedules max pods per node
390
+ `Service endpoints latency` , // requires low latency
391
+ `Clean up pods on node` , // schedules up to max pods per node
347
392
}
348
- serialConformanceTestsFilter = regexp .MustCompile (strings .Join (serialConformanceTests , `|` ))
393
+ serialTestsFilter = regexp .MustCompile (strings .Join (serialTests , `|` ))
349
394
)
350
395
351
396
// checkSyntheticInput selects tests based on synthetic skips or focuses
352
397
func checkSyntheticInput () {
353
- checkSuiteFocuses ()
354
398
checkSuiteSkips ()
355
399
}
356
400
357
- // checkSuiteFocuses ensures Origin conformance suite synthetic labels are applied
358
- func checkSuiteFocuses () {
359
- if ! strings .Contains (syntheticSuite , "conformance.openshift.io" ) {
360
- return
361
- }
362
-
363
- testName := []byte (ginkgo .CurrentGinkgoTestDescription ().FullTestText )
364
- testFocused := false
365
- textExcluded := excludedTestsFilter .Match (testName )
366
- if syntheticSuite == "parallel.conformance.openshift.io" {
367
- testFocused = parallelConformanceTestsFilter .Match (testName )
368
- textExcluded = textExcluded || serialConformanceTestsFilter .Match (testName )
369
- } else if syntheticSuite == "serial.conformance.openshift.io" {
370
- testFocused = serialConformanceTestsFilter .Match (testName )
371
- }
372
-
373
- if ! testFocused || textExcluded {
374
- ginkgo .Skip ("skipping tests not in the Origin conformance suite" )
375
- }
376
- }
377
-
378
401
// checkSuiteSkips ensures Origin/Kubernetes synthetic skip labels are applied
402
+ // DEPRECATED: remove in a future release
379
403
func checkSuiteSkips () {
380
404
switch {
381
405
case isOriginTest ():
0 commit comments