Skip to content

Commit 4d9b126

Browse files
committed
remove annotations and replace with environment selector based test skipping and disablement
remove the render_test_report command as it is no longer used, and update vendor files add suite to the name put annotation framework back for k8s tests only don't add suite info to excluded tests log new test name for storage test rename purposes exclude suite names from External Storage tests remove util/annotate separate out suite appending logic to helper function deps
1 parent a08d2f3 commit 4d9b126

File tree

25 files changed

+485
-6093
lines changed

25 files changed

+485
-6093
lines changed

README.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,29 @@ will switch to vendoring origin-specific branches (e.g
3737
carries that need to be considered in the context of
3838
`openshift/kubernetes` rebases.
3939

40-
### Test annotation rules
40+
### Test exclusion rules
4141

42-
Test annotation rules are used to label e2e tests so that they can be
43-
filtered or skipped. For example, rules can be defined that match kube
44-
e2e tests that are known to be incompatible with openshift and label
45-
those tests to be skipped.
42+
Test exclusion is now handled through environmental selector based filtering
43+
rather than test annotations. Environmental selectors allow tests to be
44+
filtered or skipped based on the cluster environment and configuration.
45+
For example, selectors can be defined that match kube e2e tests that are
46+
known to be incompatible with specific OpenShift configurations and exclude
47+
those tests from running.
4648

47-
Maintenance of test annotation rules is split between the
49+
Maintenance of test exclusion rules is split between the
4850
`openshift/kubernetes` and `origin` repos to ensure that PRs proposed
4951
to `openshift/kubernetes` can be validated against the set of kube e2e
50-
tests known to be compatible with openshift.
52+
tests known to be compatible with OpenShift.
5153

52-
Test annotation rules for kubernetes e2e tests are maintained in:
54+
Test exclusion rules for kubernetes e2e tests are maintained in: https://github.com/openshift/kubernetes/blob/master/openshift-hack/cmd/k8s-tests-ext:
55+
* [environment_selectors.go](https://github.com/openshift/kubernetes/blob/master/openshift-hack/cmd/k8s-tests-ext/environment_selectors.go)
56+
* [disabled_tests.go](https://github.com/openshift/kubernetes/blob/master/openshift-hack/cmd/k8s-tests-ext/disabled_tests.go)
5357

54-
https://github.com/openshift/kubernetes/blob/master/openshift-hack/e2e/annotate/rules.go
58+
Test exclusion rules for openshift e2e tests are maintained in: https://github.com/openshift/origin/blob/main/pkg/test/extensions:
59+
* [environment_selectors.go](https://github.com/openshift/origin/blob/main/pkg/test/extensions/environment_selectors.go)
60+
* [disabled_tests.go](https://github.com/openshift/origin/blob/main/pkg/test/extensions/disabled_tests.go)
5561

56-
Test annotation rules for openshift e2e tests are maintained in:
57-
58-
https://github.com/openshift/origin/blob/main/test/extended/util/annotate/rules.go
59-
60-
Origin vendors the kube rules and applies both the kube and openshift
61-
rules to the set of tests included in the `openshift-tests` binary.
62-
63-
In order to update test annotation rules for kube e2e tests, it will
64-
be necessary to:
65-
66-
- Update `rules.go` in `openshift/kubernetes`
67-
- Bump the version of `openshift/kubernetes` vendored in origin
62+
To update test exclusion rules for kube e2e tests, update the environmental selectors in `openshift/kubernetes`. For OpenShift e2e tests, update the selectors in `origin`.
6863

6964
### Vendoring from `openshift/kubernetes`
7065

cmd/openshift-tests/openshift-tests.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor"
2929
run_monitor "github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/run"
3030
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/timeline"
31-
"github.com/openshift/origin/pkg/cmd/openshift-tests/render"
3231
risk_analysis "github.com/openshift/origin/pkg/cmd/openshift-tests/risk-analysis"
3332
"github.com/openshift/origin/pkg/cmd/openshift-tests/run"
3433
run_disruption "github.com/openshift/origin/pkg/cmd/openshift-tests/run-disruption"
@@ -106,7 +105,6 @@ func main() {
106105
timeline.NewTimelineCommand(ioStreams),
107106
run_disruption.NewRunInClusterDisruptionMonitorCommand(ioStreams),
108107
collectdiskcertificates.NewRunCollectDiskCertificatesCommand(ioStreams),
109-
render.NewRenderCommand(ioStreams),
110108
versioncmd.NewVersionCommand(ioStreams),
111109
)
112110

hack/update-generated.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
77
# https://github.com/kubernetes/kubernetes/pull/109541
88
ENABLE_STORAGE_GCE_PD_DRIVER=yes go generate -mod vendor ./test/extended
99

10-
# the test names are now contained in test/extended/util/annotate/generated/zz_generated.annotations.go
11-
# A txt file would be more extensible, but Maciej stacked the debt here and he's the same person who will have pay it down
12-
# as we add more images with more tests, so this seems acceptable.
13-
go run -mod vendor ./cmd/openshift-tests render test-report --output-dir=./zz_generated.manifests
14-
1510
# Update mirror mapping from upstream to quay
1611
# By default, "openshift-tests images" lists images from external binaries. However, we force
1712
# this script to list images from built-in tests in order to avoid requiring an OCP release image.

hack/verify-generated.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ trap "cleanup" EXIT
1111

1212
os::test::junit::declare_suite_start "verify/generated"
1313
os::cmd::expect_success "${OS_ROOT}/hack/update-generated.sh"
14-
os::cmd::expect_success "git diff --exit-code ${OS_ROOT}/test/extended/util/annotate/generated/"
1514
os::cmd::expect_success "git diff --exit-code ${OS_ROOT}/test/extended/util/image/zz_generated.txt"
16-
os::cmd::expect_success "git diff --exit-code ${OS_ROOT}/zz_generated.manifests"
1715

1816
os::test::junit::declare_suite_end

images/tests/Dockerfile.rhel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ RUN make; \
77

88
FROM registry.ci.openshift.org/ocp/4.20:tools
99
COPY --from=builder /tmp/build/openshift-tests /usr/bin/
10-
RUN mkdir -p /manifests
11-
COPY --from=builder /go/src/github.com/openshift/origin/zz_generated.manifests/* /manifests
1210

1311
RUN PACKAGES="git gzip util-linux" && \
1412
if [ $HOSTTYPE = x86_64 ]; then PACKAGES="$PACKAGES python3-cinderclient"; fi && \

pkg/cmd/openshift-tests/render/render_command.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

pkg/cmd/openshift-tests/render/test-report/render_test_report.go

Lines changed: 0 additions & 176 deletions
This file was deleted.

pkg/cmd/openshift-tests/render/test-report/render_test_report_test.go

Lines changed: 0 additions & 37 deletions
This file was deleted.

pkg/test/extensions/binary.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ import (
1616
"syscall"
1717
"time"
1818

19-
originVersion "github.com/openshift/origin/pkg/version"
20-
2119
"github.com/openshift-eng/openshift-tests-extension/pkg/extension"
2220
"github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
2321
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
22+
originVersion "github.com/openshift/origin/pkg/version"
2423
"github.com/pkg/errors"
2524
"github.com/sirupsen/logrus"
2625
"golang.org/x/mod/semver"
@@ -34,7 +33,6 @@ import (
3433
"github.com/openshift/origin/pkg/clioptions/imagesetup"
3534
"github.com/openshift/origin/pkg/clioptions/upgradeoptions"
3635
exutil "github.com/openshift/origin/test/extended/util"
37-
origingenerated "github.com/openshift/origin/test/extended/util/annotate/generated"
3836
"github.com/openshift/origin/test/extended/util/image"
3937
)
4038

@@ -78,24 +76,26 @@ func InitializeOpenShiftTestsExtensionFramework() (*extension.Registry, *extensi
7876
return nil, nil, fmt.Errorf("failed to build extension test specs: %w", err)
7977
}
8078

81-
// Apply annotations to test names
79+
// Apply annotations to test names only for upstream tests
8280
specs.Walk(func(spec *extensiontests.ExtensionTestSpec) {
83-
// we need to ensure the default path always annotates both
84-
// origin and k8s tests accordingly, since each of these
85-
// currently have their own annotations which are not
86-
// merged anywhere else but applied here
87-
if append, ok := origingenerated.Annotations[spec.Name]; ok {
88-
spec.Name += append
89-
}
9081
if append, ok := k8sgenerated.Annotations[spec.Name]; ok {
9182
spec.Name += append
9283
}
9384
})
9485

86+
klog.Infof("Found %d test specs", len(specs))
9587
// Filter out kube tests, vendor filtering isn't working within origin
9688
specs = specs.Select(func(spec *extensiontests.ExtensionTestSpec) bool {
9789
return !strings.Contains(spec.Name, "[Suite:k8s")
9890
})
91+
klog.Infof("%d test specs remain, after filtering out k8s", len(specs))
92+
93+
// Filter out tests that are always disabled based on name matching
94+
specs = filterOutDisabledSpecs(specs)
95+
// Add environment selectors that include or exclude tests in specific environments
96+
addEnvironmentSelectors(specs)
97+
addLabelsToSpecs(specs)
98+
appendSuiteNames(specs)
9999

100100
specs.AddBeforeAll(func() {
101101
config, err := clusterdiscovery.DecodeProvider(os.Getenv("TEST_PROVIDER"), false, false, nil)

0 commit comments

Comments
 (0)