coarse serialization of storage tests
@@ -141,6 +141,13 @@ func (opt *Options) SelectSuite(suites []*TestSuite, args []string) (*TestSuite,
return suite, nil
}
+func max(a, b int) int {
+ if a > b {
+ return a
+ }
+ return b
+}
+
func (opt *Options) Run(suite *TestSuite, junitSuiteName string) error {
if len(opt.Regex) > 0 {
if err := filterWithRegex(suite, opt.Regex); err != nil {
@@ -279,27 +286,33 @@ func (opt *Options) Run(suite *TestSuite, junitSuiteName string) error {
includeSuccess = true
}
- early, others := splitTests(tests, func(t *testCase) bool {
+ early, notEarly := splitTests(tests, func(t *testCase) bool {
return strings.Contains(t.name, "[Early]")
})
- late, others := splitTests(others, func(t *testCase) bool {
+ late, primaryTests := splitTests(notEarly, func(t *testCase) bool {
return strings.Contains(t.name, "[Late]")
})
- kubeTests, openshiftTests := splitTests(others, func(t *testCase) bool {
+ kubeTests, openshiftTests := splitTests(primaryTests, func(t *testCase) bool {
return strings.Contains(t.name, "[Suite:k8s]")
})
+ storageTests, kubeTests := splitTests(kubeTests, func(t *testCase) bool {
+ return strings.Contains(t.name, "[sig-storage]")
+ })
+
// If user specifies a count, duplicate the kube and openshift tests that many times.
expectedTestCount := len(early) + len(late)
if count != -1 {
originalKube := kubeTests
originalOpenshift := openshiftTests
+ originalStorage := storageTests
for i := 1; i < count; i++ {
kubeTests = append(kubeTests, copyTests(originalKube)...)
openshiftTests = append(openshiftTests, copyTests(originalOpenshift)...)
+ storageTests = append(storageTests, copyTests(originalStorage)...)
}
}
expectedTestCount += len(openshiftTests) + len(kubeTests)
@@ -333,6 +346,11 @@ func (opt *Options) Run(suite *TestSuite, junitSuiteName string) error {
q.Execute(testCtx, kubeTestsCopy, parallelism, status.Run)
tests = append(tests, kubeTestsCopy...)
+ // I thought about randomizing the order of the kube, storage, and openshift tests, but storage dominates our e2e runs, so it doesn't help much.
+ storageTestsCopy := copyTests(storageTests)
+ q.Execute(testCtx, storageTestsCopy, max(1, parallelism/2), status.Run) // storage tests only run at half the parallelism, so we can avoid cloud provider quota problems.
+ tests = append(tests, storageTestsCopy...)
+
openshiftTestsCopy := copyTests(openshiftTests)
q.Execute(testCtx, openshiftTestsCopy, parallelism, status.Run)
tests = append(tests, openshiftTestsCopy...)
