Skip to content

Commit

Permalink
Make focus and skip a lot easier to use in extended tests
Browse files Browse the repository at this point in the history
Now:

    ginkgo ... -focus=Suite:openshift/conformance/parallel
    ginkgo ... -focus=Suite:openshift/conformance/serial

Both

    ginkgo ... -focus=Suite:openshift/conformance

Kubernetes

    ginkgo ... -focus=Suite:k8s
  • Loading branch information
smarterclayton committed Aug 23, 2017
1 parent b7c80e4 commit 5f60b0d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/extended/util/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/ginkgo/types"
"github.com/onsi/gomega"

apierrs "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -113,6 +114,30 @@ func ExecuteTest(t *testing.T, suite string) {
r = append(r, reporters.NewJUnitReporter(path.Join(reportDir, fmt.Sprintf("%s_%02d.xml", reportFileName, config.GinkgoConfig.ParallelNode))))
}

ginkgo.WalkTests(func(name string, node types.TestNode) {
if !excludedTestsFilter.MatchString(name) {
parallel := parallelConformanceTestsFilter.MatchString(name)
serial := serialConformanceTestsFilter.MatchString(name)
switch {
case !serial && !parallel:
// do nothing
case serial:
if !strings.Contains(name, "[Serial]") {
node.SetText(node.Text() + " [Serial]")
}
node.SetText(node.Text() + " [Suite:openshift/conformance/serial]")
default:
node.SetText(node.Text() + " [Suite:openshift/conformance/parallel]")
}
}
if strings.Contains(node.CodeLocation().FileName, "/origin/test/") && !strings.Contains(node.Text(), "[Suite:openshift") {
node.SetText(node.Text() + " [Suite:openshift]")
}
if strings.Contains(node.CodeLocation().FileName, "/kubernetes/test/e2e/") {
node.SetText(node.Text() + " [Suite:k8s]")
}
})

if quiet {
r = append(r, NewSimpleReporter())
ginkgo.RunSpecsWithCustomReporters(t, suite, r)
Expand Down

0 comments on commit 5f60b0d

Please sign in to comment.