Skip to content

Commit

Permalink
Remove KubeDescribe
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-t committed Mar 4, 2021
1 parent 3ce9316 commit d4883f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
6 changes: 3 additions & 3 deletions test/conformance/walk_test.go
Expand Up @@ -57,7 +57,7 @@ func TestConformance(t *testing.T) {
filename: "e2e/foo.go",
code: `package test
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
Context("with context and extra spaces before It block should still pick up Testname", func() {
// Testname: Test with spaces
//Description: Should pick up testname even if it is not within 3 spaces
Expand All @@ -77,7 +77,7 @@ func TestConformance(t *testing.T) {
filename: "e2e/foo.go",
code: `package test
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
Context("with context and extra spaces before It block should still pick up Testname", func() {
// Testname: First test
// Description: Should pick up testname even if it is not within 3 spaces
Expand All @@ -101,7 +101,7 @@ func TestConformance(t *testing.T) {
filename: "e2e/foo.go",
code: `package test
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
Context("with context and extra spaces before It block should still pick up Testname", func() {
// Testname: First test
// Description: Should target the correct test/comment based on the line numbers
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/framework/framework.go
Expand Up @@ -625,12 +625,6 @@ func (kc *KubeConfig) FindCluster(name string) *KubeCluster {
return nil
}

// KubeDescribe is wrapper function for ginkgo describe. Adds namespacing.
// TODO: Support type safe tagging as well https://github.com/kubernetes/kubernetes/pull/22401.
func KubeDescribe(text string, body func()) bool {
return ginkgo.Describe("[k8s.io] "+text, body)
}

// ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.
func ConformanceIt(text string, body interface{}, timeout ...float64) bool {
return ginkgo.It(text+" [Conformance]", body, timeout...)
Expand Down
8 changes: 2 additions & 6 deletions test/list/main.go
Expand Up @@ -155,16 +155,12 @@ func (w *walker) firstArg(n *ast.CallExpr) string {
}

// describeName returns the first argument of a function if it's
// a Ginkgo-relevant function (Describe/KubeDescribe/Context),
// a Ginkgo-relevant function (Describe/SIGDescribe/Context),
// and the empty string otherwise.
func (w *walker) describeName(n *ast.CallExpr) string {
switch x := n.Fun.(type) {
case *ast.SelectorExpr:
if x.Sel.Name != "KubeDescribe" {
return ""
}
case *ast.Ident:
if x.Name != "Describe" && x.Name != "Context" {
if x.Name != "SIGDescribe" && x.Name != "Describe" && x.Name != "Context" {
return ""
}
default:
Expand Down
24 changes: 12 additions & 12 deletions test/list/main_test.go
Expand Up @@ -43,43 +43,43 @@ var _ = Describe("Feature", func() {
It("should work properly", func() {})
})`, []Test{{"e2e/foo.go:4:2", "[k8s.io] Feature", "should work properly"}},
},
// KubeDescribe + It
// SIGDescribe + It
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
It("should work properly", func() {})
})`, []Test{{"e2e/foo.go:4:2", "[k8s.io] Feature", "should work properly"}},
},
// KubeDescribe + Context + It
// SIGDescribe + Context + It
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
Context("when offline", func() {
It("should work", func() {})
})
})`, []Test{{"e2e/foo.go:5:3", "[k8s.io] Feature when offline", "should work"}},
},
// KubeDescribe + It(Sprintf)
// SIGDescribe + It(Sprintf)
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
It(fmt.Sprintf("handles %d nodes", num), func() {})
})`, []Test{{"e2e/foo.go:4:2", "[k8s.io] Feature", "handles * nodes"}},
},
// KubeDescribe + Sprintf + It(var)
// SIGDescribe + Sprintf + It(var)
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
arg := fmt.Sprintf("does %s and %v at %d", task, desc, num)
It(arg, func() {})
})`, []Test{{"e2e/foo.go:5:2", "[k8s.io] Feature", "does * and * at *"}},
},
// KubeDescribe + string + It(var)
// SIGDescribe + string + It(var)
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
arg := "does stuff"
It(arg, func() {})
})`, []Test{{"e2e/foo.go:5:2", "[k8s.io] Feature", "does stuff"}},
},
// KubeDescribe + It(unknown)
// SIGDescribe + It(unknown)
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
var _ = SIGDescribe("Feature", func() {
It(mysteryFunc(), func() {})
})`, []Test{{"e2e/foo.go:4:2", "[k8s.io] Feature", "*"}},
},
Expand Down

0 comments on commit d4883f5

Please sign in to comment.