Skip to content

Commit b7e0cf6

Browse files
committed
UPSTREAM: <carry>: remove annotation framework in favor of environment selectors
1 parent 9c2642e commit b7e0cf6

14 files changed

+12
-14667
lines changed

REBASE.openshift.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,20 @@ go mod tidy && go mod vendor
273273

274274
Alternatively, you can edit `go.mod` file manually with your favourite editor and use search&replace.
275275

276-
## Review test annotation rules
276+
## Review test environmental selection rules
277277

278-
The names of upstream e2e tests are annotated according to the a set of
279-
[declarative rules](openshift-hack/e2e/annotate/rules.go). These annotations
280-
are used to group tests into suites and to skip tests that are known not to be
281-
incompatible with some or all configurations of OpenShift.
278+
Test environmental selection rules are defined in two files:
279+
- [disabled_tests.go](openshift-hack/cmd/k8s-tests-ext/disabled_tests.go) - for completely disabled tests
280+
- [environment_selectors.go](openshift-hack/cmd/k8s-tests-ext/environment_selectors.go) - for conditionally skipped tests
281+
282+
These rules are used to skip tests that are known to be incompatible with some or all configurations of OpenShift.
282283

283284
When performing a rebase, it is important to review the rules to
284285
ensure they are still relevant:
285286

286-
- [ ] Ensure that `[Disabled:Alpha]` rules are appropriate for the current kube
287+
- [ ] Ensure that `Alpha` rules in [disabled_tests.go](openshift-hack/cmd/k8s-tests-ext/disabled_tests.go) are appropriate for the current kube
287288
level. Alpha features that are not enabled by default should be targeted
288-
by this annotation to ensure that tests of those features are skipped.
289+
by these rules to ensure that tests of those features are skipped.
289290
- [ ] Add new skips (along with a bz to track resolution) where e2e tests fail
290291
consistently.
291292

hack/update-test-annotations.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

hack/verify-test-annotations.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

openshift-hack/cmd/k8s-tests-ext/k8s-tests.go

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ package main
22

33
import (
44
"flag"
5-
"fmt"
65
"os"
76
"reflect"
8-
"strconv"
97

10-
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
11-
12-
"k8s.io/kubernetes/openshift-hack/e2e/annotate/generated"
138
"k8s.io/kubernetes/test/e2e/framework"
149

1510
"github.com/spf13/cobra"
@@ -61,31 +56,31 @@ func main() {
6156
Parents: []string{
6257
"openshift/conformance/parallel/minimal",
6358
},
64-
Qualifiers: []string{withExcludedTestsFilter(`!name.contains('[Serial]') && labels.exists(l, l == "Conformance")`)},
59+
Qualifiers: []string{`!name.contains('[Serial]') && labels.exists(l, l == "Conformance")`},
6560
})
6661

6762
kubeTestsExtension.AddSuite(e.Suite{
6863
Name: "kubernetes/conformance/serial/minimal",
6964
Parents: []string{
7065
"openshift/conformance/serial/minimal",
7166
},
72-
Qualifiers: []string{withExcludedTestsFilter(`name.contains('[Serial]') && labels.exists(l, l == "Conformance")`)},
67+
Qualifiers: []string{`name.contains('[Serial]') && labels.exists(l, l == "Conformance")`},
7368
})
7469

7570
kubeTestsExtension.AddSuite(e.Suite{
7671
Name: "kubernetes/conformance/parallel",
7772
Parents: []string{
7873
"openshift/conformance/parallel",
7974
},
80-
Qualifiers: []string{withExcludedTestsFilter(`!name.contains('[Serial]')`)},
75+
Qualifiers: []string{`!name.contains('[Serial]')`},
8176
})
8277

8378
kubeTestsExtension.AddSuite(e.Suite{
8479
Name: "kubernetes/conformance/serial",
8580
Parents: []string{
8681
"openshift/conformance/serial",
8782
},
88-
Qualifiers: []string{withExcludedTestsFilter(`name.contains('[Serial]')`)},
83+
Qualifiers: []string{`name.contains('[Serial]')`},
8984
})
9085

9186
for k, v := range image.GetOriginalImageConfigs() {
@@ -109,30 +104,6 @@ func main() {
109104
}
110105
})
111106

112-
// Annotations get appended to test names, these are additions to upstream
113-
// tests for controlling skips, suite membership, etc.
114-
//
115-
// TODO:
116-
// - Remove this annotation code, and migrate to Labels/Tags and
117-
// the environmental skip code from the enhancement once its implemented.
118-
// - Make sure to account for test renames that occur because of removal of these
119-
// annotations
120-
var omitAnnotations bool
121-
omitAnnotationsVal := os.Getenv("OMIT_ANNOTATIONS")
122-
if omitAnnotationsVal != "" {
123-
omitAnnotations, err = strconv.ParseBool(omitAnnotationsVal)
124-
if err != nil {
125-
panic("Failed to parse OMIT_ANNOTATIONS: " + err.Error())
126-
}
127-
}
128-
if !omitAnnotations {
129-
specs.Walk(func(spec *et.ExtensionTestSpec) {
130-
if annotations, ok := generated.Annotations[spec.Name]; ok {
131-
spec.Name += annotations
132-
}
133-
})
134-
}
135-
136107
specs = filterOutDisabledSpecs(specs)
137108
addLabelsToSpecs(specs)
138109

@@ -179,27 +150,3 @@ func convertToImage(obj interface{}) e.Image {
179150
}
180151
return image
181152
}
182-
183-
func withExcludedTestsFilter(baseExpr string) string {
184-
excluded := []string{
185-
"[Disabled:",
186-
"[Disruptive]",
187-
"[Skipped]",
188-
"[Slow]",
189-
"[Flaky]",
190-
"[Local]",
191-
}
192-
193-
filter := ""
194-
for i, s := range excluded {
195-
if i > 0 {
196-
filter += " && "
197-
}
198-
filter += fmt.Sprintf("!name.contains('%s')", s)
199-
}
200-
201-
if baseExpr != "" {
202-
return fmt.Sprintf("(%s) && (%s)", baseExpr, filter)
203-
}
204-
return filter
205-
}

0 commit comments

Comments
 (0)