Skip to content

Commit 507621e

Browse files
committed
implement WithFeatureGate label proposal
Ginkgo label changes: - Feature:Alpha => Alpha - Feature:Beta => Beta - Feature:OffByDefault mirrored to labels from test name - BetaOffByDefault label added
1 parent 67bdb11 commit 507621e

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

test/e2e/framework/ginkgowrapper.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,16 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf
210210
addLabel(fullLabel)
211211
if arg.alphaBetaLevel != "" {
212212
texts = append(texts, fmt.Sprintf("[%[1]s]", arg.alphaBetaLevel))
213-
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:"+arg.alphaBetaLevel))
213+
ginkgoArgs = append(ginkgoArgs, ginkgo.Label(arg.alphaBetaLevel))
214214
}
215215
if arg.offByDefault {
216216
texts = append(texts, "[Feature:OffByDefault]")
217-
// TODO: consider this once we have a plan to update the alpha/beta job filters
218-
// ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:OffByDefault"))
217+
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:OffByDefault"))
218+
// Alphas are always off by default but we may want to select
219+
// betas based on defaulted-ness.
220+
if arg.alphaBetaLevel == "Beta" {
221+
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("BetaOffByDefault"))
222+
}
219223
}
220224
if fullLabel == "Serial" {
221225
ginkgoArgs = append(ginkgoArgs, ginkgo.Serial)
@@ -374,12 +378,18 @@ func withFeature(name Feature) interface{} {
374378
// on the current stability level of the feature, to emulate historic
375379
// usage of those tags.
376380
//
377-
// In addition, [Feature:Alpha] resp. [Feature:Beta] get added to support
378-
// skipping a test with a dependency on an alpha or beta feature gate in
379-
// jobs which use the traditional \[Feature:.*\] skip regular expression.
381+
// For label filtering, Alpha resp. Beta get added to the Ginkgo labels.
380382
//
381-
// For label filtering, Feature:Alpha resp. Feature:Beta get added to the
382-
// Ginkgo labels.
383+
// [Feature:OffByDefault] gets added to support skipping a test with
384+
// a dependency on an alpha or beta feature gate in jobs which use the
385+
// traditional \[Feature:.*\] skip regular expression.
386+
//
387+
// Feature:OffByDefault is also available for label filtering.
388+
//
389+
// BetaOffByDefault is also added *only as a label* when the feature gate is
390+
// an off by default beta feature. This can be used to include/exclude based
391+
// on beta + defaulted-ness. Alpha has no equivalent because all alphas are
392+
// off by default.
383393
//
384394
// If the test can run in any cluster that has alpha resp. beta features and
385395
// API groups enabled, then annotating it with just WithFeatureGate is

test/e2e/framework/internal/unittests/bugs/bugs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ ERROR: some/relative/path/buggy.go:200: with spaces
129129

130130
// Used by unittests/list-labels.
131131
ListLabelsOutput = `The following labels can be used with 'ginkgo run --label-filter':
132+
Alpha
133+
Beta
134+
BetaOffByDefault
132135
Conformance
133136
Disruptive
134137
Environment:Linux
135138
Environment:no-such-env
136-
Feature:Alpha
137-
Feature:Beta
139+
Feature:OffByDefault
138140
Feature:feature-foo
139141
Feature:no-such-feature
140142
FeatureGate:TestAlphaFeature

0 commit comments

Comments
 (0)