Remove KubeDescribe

This commit is contained in:
wojtekt 2021-03-03 11:29:04 +01:00
parent 3ce93161fe
commit d4883f532e
4 changed files with 17 additions and 27 deletions

View File

@ -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
@ -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
@ -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

View File

@ -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...)

View File

@ -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:

View File

@ -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", "*"}},
},