From d4883f532e8a3e138c5ef2e65382eba41ad35136 Mon Sep 17 00:00:00 2001 From: wojtekt Date: Wed, 3 Mar 2021 11:29:04 +0100 Subject: [PATCH] Remove KubeDescribe --- test/conformance/walk_test.go | 6 +++--- test/e2e/framework/framework.go | 6 ------ test/list/main.go | 8 ++------ test/list/main_test.go | 24 ++++++++++++------------ 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/test/conformance/walk_test.go b/test/conformance/walk_test.go index 7d1f105168a2..950024e4e069 100644 --- a/test/conformance/walk_test.go +++ b/test/conformance/walk_test.go @@ -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 diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index eec2cad0e484..25c031bd27c8 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -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...) diff --git a/test/list/main.go b/test/list/main.go index bc4904b4ce9a..31ae209b0c0e 100644 --- a/test/list/main.go +++ b/test/list/main.go @@ -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: diff --git a/test/list/main_test.go b/test/list/main_test.go index 4474f4ac6d72..fd2145837e23 100644 --- a/test/list/main_test.go +++ b/test/list/main_test.go @@ -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", "*"}}, },