Conformance walker should handle nested/adjacent Describes

This also revealed that the regex for Context was too generous and would
catch things like SecurityContext or ContextWithFoo(...) calls

This ensures that test suites with a ineligible tag in their top-level
Describe will be rejected from promotion to conformance
This commit is contained in:
Aaron Crickenberger
2019-06-24 09:35:12 -07:00
parent 20e97a6b4b
commit ffe70f1a6e
2 changed files with 53 additions and 14 deletions

View File

@@ -69,6 +69,23 @@ var _ = framework.KubeDescribe("Feature", func() {
Description: `By default the stdout and stderr from the process
being executed in a pod MUST be sent to the pod's logs.` + "\n\n"}},
},
// SIGDescribe + KubeDescribe + It, Describe + KubeDescribe + It
{"e2e/foo.go", `
var _ = framework.SIGDescribe("Feature", func() {
KubeDescribe("Described by", func() {
// Description: description1
framework.ConformanceIt("A ConformanceIt", func() {})
})
Describe("Also described via", func() {
KubeDescribe("A nested", func() {
// Description: description2
framework.ConformanceIt("ConformanceIt", func() {})
})
})
})`, []conformanceData{
{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L6", TestName: "Feature Described by A ConformanceIt", Description: "description1\n\n"},
{URL: "https://github.com/kubernetes/kubernetes/tree/master/e2e/foo.go#L11", TestName: "Feature Also described via A nested ConformanceIt", Description: "description2\n\n"},
}},
// KubeDescribe + Context + It
{"e2e/foo.go", `
var _ = framework.KubeDescribe("Feature", func() {
@@ -101,7 +118,7 @@ func TestConformance(t *testing.T) {
*confDoc = true
tests := scanfile(test.filename, code)
if !reflect.DeepEqual(tests, test.output) {
t.Errorf("code:\n%s\ngot %v\nwant %v",
t.Errorf("code:\n%s\ngot %+v\nwant %+v",
code, tests, test.output)
}
}