Make cmd/e2e --test work after the conversion to Ginkgo

Use the --ginkgo.focus flag which accepts a regexp to define which tests
should be run. Create a regexp matching a full word that is exactly one
of the test names passed as -t parameters.

Tested with cmd/e2e -t TestLivenessHttp -t TestLivenessExec, confirmed
that 2 tests were executed and 9 were skipped.
This commit is contained in:
Filipe Brandenburger 2015-01-28 21:11:23 -08:00
parent 47739abb30
commit fa845030c4

View File

@ -18,6 +18,8 @@ package e2e
import (
"path"
"regexp"
"strings"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
@ -57,7 +59,17 @@ func RunE2ETests(authConfig, certDir, host, repoRoot, provider string, orderseed
glog.Fatalf("This test has timed out. Cleanup not guaranteed.")
}()
// TODO: Make -t TestName work again.
if len(testList) != 0 {
if config.GinkgoConfig.FocusString != "" || config.GinkgoConfig.SkipString != "" {
glog.Fatal("Either specify --test/-t or --ginkgo.focus/--ginkgo.skip but not both.")
}
var testRegexps []string
for _, t := range testList {
testRegexps = append(testRegexps, regexp.QuoteMeta(t))
}
config.GinkgoConfig.FocusString = `\b(` + strings.Join(testRegexps, "|") + `)\b`
}
// TODO: Make "times" work again.
// TODO: Make orderseed work again.