mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
Error on tests ineligible for promotion to conformance
If there are tags in the test name that describe qualities of the test that make it ineligible for conformance, raise an error. This is basically the "skip list" that heptio's e2e image used to use. Thankfully all of our existing Conformance tests lack these tags. I considered added [Slow] to the list, but let's save that for another day.
This commit is contained in:
@@ -41,6 +41,9 @@ var (
|
||||
baseURL = flag.String("url", "https://github.com/kubernetes/kubernetes/tree/master/", "location of the current source")
|
||||
confDoc = flag.Bool("conformance", false, "write a conformance document")
|
||||
totalConfTests, totalLegacyTests, missingComments int
|
||||
|
||||
// If a test name contains any of these tags, it is ineligble for promotion to conformance
|
||||
regexIneligibleTags = regexp.MustCompile(`\[(Alpha|Disruptive|Feature:[^\]]+|Flaky)\]`)
|
||||
)
|
||||
|
||||
const regexDescribe = "Describe|KubeDescribe|SIGDescribe"
|
||||
@@ -199,6 +202,12 @@ func (v *visitor) emit(arg ast.Expr) {
|
||||
return
|
||||
}
|
||||
|
||||
err := validateTestName(v.getDescription(at.Value))
|
||||
if err != nil {
|
||||
v.failf(at, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
at.Value = normalizeTestName(at.Value)
|
||||
if *confDoc {
|
||||
v.convertToConformanceData(at)
|
||||
@@ -233,6 +242,14 @@ func normalizeTestName(s string) string {
|
||||
return strings.TrimSpace(r)
|
||||
}
|
||||
|
||||
func validateTestName(s string) error {
|
||||
matches := regexIneligibleTags.FindAllString(s, -1)
|
||||
if matches != nil {
|
||||
return fmt.Errorf("'%s' cannot have invalid tags %v", s, strings.Join(matches, ","))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// funcName converts a selectorExpr with two idents into a string,
|
||||
// x.y -> "x.y"
|
||||
func funcName(n ast.Expr) string {
|
||||
|
||||
Reference in New Issue
Block a user