Skip to content

Commit 6c66b51

Browse files
committed
PoC to use OTE generated labels for skips in test-kubernetes-e2e.sh
1 parent d365efd commit 6c66b51

File tree

8 files changed

+37666
-18089
lines changed

8 files changed

+37666
-18089
lines changed

Diff for: .openshift-tests-extension/openshift_payload_hyperkube.json

+24,790-18,060
Large diffs are not rendered by default.

Diff for: openshift-hack/cmd/k8s-tests-ext/environment_selectors.go

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
3+
import (
4+
"fmt"
5+
6+
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
7+
)
48

59
// addEnvironmentSelectors adds the environmentSelector field to appropriate specs to facilitate including or excluding
610
// them based on attributes of the cluster they are running on
@@ -16,7 +20,7 @@ func addEnvironmentSelectors(specs et.ExtensionTestSpecs) {
1620
specs.SelectAny([]et.SelectFunction{ // Since these must use "NameContainsAll" they cannot be included in filterByPlatform
1721
et.NameContainsAll("[sig-network] LoadBalancers [Feature:LoadBalancer]", "UDP"),
1822
et.NameContainsAll("[sig-network] LoadBalancers [Feature:LoadBalancer]", "session affinity"),
19-
}).Exclude(et.PlatformEquals("aws"))
23+
}).Exclude(et.PlatformEquals("aws")).AddLabel("[Skipped:aws]")
2024
}
2125

2226
// filterByPlatform is a helper function to do, simple, "NameContains" filtering on tests by platform
@@ -118,7 +122,9 @@ func filterByPlatform(specs et.ExtensionTestSpecs) {
118122
selectFunctions = append(selectFunctions, et.NameContains(exclusion))
119123
}
120124

121-
specs.SelectAny(selectFunctions).Exclude(et.PlatformEquals(platform))
125+
specs.SelectAny(selectFunctions).
126+
Exclude(et.PlatformEquals(platform)).
127+
AddLabel(fmt.Sprintf("[Skipped:%s]", platform))
122128
}
123129
}
124130

@@ -160,7 +166,9 @@ func filterByExternalConnectivity(specs et.ExtensionTestSpecs) {
160166
selectFunctions = append(selectFunctions, et.NameContains(exclusion))
161167
}
162168

163-
specs.SelectAny(selectFunctions).Exclude(et.ExternalConnectivityEquals(externalConnectivity))
169+
specs.SelectAny(selectFunctions).
170+
Exclude(et.ExternalConnectivityEquals(externalConnectivity)).
171+
AddLabel(fmt.Sprintf("[Skipped:%s]", externalConnectivity))
164172
}
165173
}
166174

@@ -189,7 +197,9 @@ func filterByTopology(specs et.ExtensionTestSpecs) {
189197
selectFunctions = append(selectFunctions, et.NameContains(exclusion))
190198
}
191199

192-
specs.SelectAny(selectFunctions).Exclude(et.TopologyEquals(topology))
200+
specs.SelectAny(selectFunctions).
201+
Exclude(et.TopologyEquals(topology)).
202+
AddLabel(fmt.Sprintf("[Skipped:%s]", topology))
193203
}
194204
}
195205

@@ -208,7 +218,9 @@ func filterByNoOptionalCapabilities(specs et.ExtensionTestSpecs) {
208218
for _, exclusion := range exclusions {
209219
selectFunctions = append(selectFunctions, et.NameContains(exclusion))
210220
}
211-
specs.SelectAny(selectFunctions).Exclude(et.NoOptionalCapabilitiesExist())
221+
specs.SelectAny(selectFunctions).
222+
Exclude(et.NoOptionalCapabilitiesExist()).
223+
AddLabel("[Skipped:NoOptionalCapabilities]")
212224
}
213225

214226
// filterByNetwork is a helper function to do, simple, "NameContains" filtering on tests by network
@@ -226,6 +238,8 @@ func filterByNetwork(specs et.ExtensionTestSpecs) {
226238
selectFunctions = append(selectFunctions, et.NameContains(exclusion))
227239
}
228240

229-
specs.SelectAny(selectFunctions).Exclude(et.NetworkEquals(network))
241+
specs.SelectAny(selectFunctions).
242+
Exclude(et.NetworkEquals(network)).
243+
AddLabel(fmt.Sprintf("[Skipped:%s]", network))
230244
}
231245
}

Diff for: openshift-hack/cmd/k8s-tests-ext/k8s-tests.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"os"
66
"reflect"
77

8-
"k8s.io/kubernetes/openshift-hack/e2e/annotate/generated"
98
"k8s.io/kubernetes/test/e2e/framework"
109

1110
"github.com/spf13/cobra"
@@ -14,7 +13,6 @@ import (
1413
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
1514
"github.com/openshift-eng/openshift-tests-extension/pkg/extension"
1615
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
17-
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
1816
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
1917
v "github.com/openshift-eng/openshift-tests-extension/pkg/version"
2018

@@ -97,11 +95,11 @@ func main() {
9795
// the environmental skip code from the enhancement once its implemented.
9896
// - Make sure to account for test renames that occur because of removal of these
9997
// annotations
100-
specs.Walk(func(spec *et.ExtensionTestSpec) {
101-
if annotations, ok := generated.Annotations[spec.Name]; ok {
102-
spec.Name += annotations
103-
}
104-
})
98+
//specs.Walk(func(spec *et.ExtensionTestSpec) {
99+
// if annotations, ok := generated.Annotations[spec.Name]; ok {
100+
// spec.Name += annotations
101+
// }
102+
//})
105103

106104
specs = filterOutDisabledSpecs(specs)
107105
addLabelsToSpecs(specs)

Diff for: openshift-hack/e2e/annotate/cmd/main.go

-9
This file was deleted.

Diff for: openshift-hack/e2e/kube_e2e_test.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package e2e
22

3-
//go:generate go run -mod vendor ./annotate/cmd -- ./annotate/generated/zz_generated.annotations.go
3+
//go:generate go run -mod vendor ./label/cmd -- ./label/generated/zz_generated.labels.go
44

55
// This file duplicates most of test/e2e/e2e_test.go but limits the included
66
// tests (via include.go) to tests that are relevant to openshift.
@@ -16,7 +16,6 @@ import (
1616
"time"
1717

1818
"gopkg.in/yaml.v2"
19-
2019
// Never, ever remove the line with "/ginkgo". Without it,
2120
// the ginkgo test runner will not detect that this
2221
// directory contains a Ginkgo test suite.
@@ -37,7 +36,7 @@ import (
3736
"k8s.io/kubernetes/test/utils/image"
3837

3938
// Ensure test annotation
40-
"k8s.io/kubernetes/openshift-hack/e2e/annotate/generated"
39+
"k8s.io/kubernetes/openshift-hack/e2e/label/generated"
4140
)
4241

4342
func TestMain(m *testing.M) {
@@ -112,14 +111,17 @@ func TestE2E(t *testing.T) {
112111
// TODO(soltysh): this is raw copy from end of openshift-hack/e2e/annotate/generated/zz_generated.annotations.go
113112
// https://issues.redhat.com/browse/OCPBUGS-25641
114113
ginkgo.GetSuite().SetAnnotateFn(func(name string, node types.TestSpec) {
115-
if newLabels, ok := generated.Annotations[name]; ok {
116-
node.AppendText(newLabels)
114+
if newLabels, ok := generated.Labels[name]; ok {
115+
node.AppendText(strings.Replace(newLabels, ",", " ", -1))
117116
} else {
118-
panic(fmt.Sprintf("unable to find test %s", name))
117+
//TODO: this panic is happening because we have removed tests that OTE has disabled entirely, lets just exclude for now...
118+
//panic(fmt.Sprintf("unable to find test %s", name))
119+
node.AppendText("[Disabled:missing]")
119120
}
120121
if strings.Contains(name, "Kubectl client Kubectl prune with applyset should apply and prune objects") {
121122
fmt.Printf("Trying to annotate %q\n", name)
122123
}
124+
123125
})
124126

125127
e2e.RunE2ETests(t)

Diff for: openshift-hack/e2e/label/cmd/main.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package main
2+
3+
import (
4+
"k8s.io/kubernetes/openshift-hack/e2e/label"
5+
)
6+
7+
func main() {
8+
//annotate.Run(annotate.TestMaps, func(name string) bool { return false }) TODO
9+
label.Run()
10+
}

0 commit comments

Comments
 (0)