mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Merge pull request #130908 from BenTheElder/test-labels-match
Implement WithFeatureGate label proposal
This commit is contained in:
@@ -210,12 +210,16 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf
|
||||
addLabel(fullLabel)
|
||||
if arg.alphaBetaLevel != "" {
|
||||
texts = append(texts, fmt.Sprintf("[%[1]s]", arg.alphaBetaLevel))
|
||||
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:"+arg.alphaBetaLevel))
|
||||
ginkgoArgs = append(ginkgoArgs, ginkgo.Label(arg.alphaBetaLevel))
|
||||
}
|
||||
if arg.offByDefault {
|
||||
texts = append(texts, "[Feature:OffByDefault]")
|
||||
// TODO: consider this once we have a plan to update the alpha/beta job filters
|
||||
// ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:OffByDefault"))
|
||||
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("Feature:OffByDefault"))
|
||||
// Alphas are always off by default but we may want to select
|
||||
// betas based on defaulted-ness.
|
||||
if arg.alphaBetaLevel == "Beta" {
|
||||
ginkgoArgs = append(ginkgoArgs, ginkgo.Label("BetaOffByDefault"))
|
||||
}
|
||||
}
|
||||
if fullLabel == "Serial" {
|
||||
ginkgoArgs = append(ginkgoArgs, ginkgo.Serial)
|
||||
@@ -374,12 +378,18 @@ func withFeature(name Feature) interface{} {
|
||||
// on the current stability level of the feature, to emulate historic
|
||||
// usage of those tags.
|
||||
//
|
||||
// In addition, [Feature:Alpha] resp. [Feature:Beta] get added to support
|
||||
// skipping a test with a dependency on an alpha or beta feature gate in
|
||||
// jobs which use the traditional \[Feature:.*\] skip regular expression.
|
||||
// For label filtering, Alpha resp. Beta get added to the Ginkgo labels.
|
||||
//
|
||||
// For label filtering, Feature:Alpha resp. Feature:Beta get added to the
|
||||
// Ginkgo labels.
|
||||
// [Feature:OffByDefault] gets added to support skipping a test with
|
||||
// a dependency on an alpha or beta feature gate in jobs which use the
|
||||
// traditional \[Feature:.*\] skip regular expression.
|
||||
//
|
||||
// Feature:OffByDefault is also available for label filtering.
|
||||
//
|
||||
// BetaOffByDefault is also added *only as a label* when the feature gate is
|
||||
// an off by default beta feature. This can be used to include/exclude based
|
||||
// on beta + defaulted-ness. Alpha has no equivalent because all alphas are
|
||||
// off by default.
|
||||
//
|
||||
// If the test can run in any cluster that has alpha resp. beta features and
|
||||
// API groups enabled, then annotating it with just WithFeatureGate is
|
||||
|
@@ -80,6 +80,7 @@ func Describe() {
|
||||
framework.WithFeatureGate("no-such-feature-gate"),
|
||||
framework.WithFeatureGate(features.Alpha),
|
||||
framework.WithFeatureGate(features.Beta),
|
||||
framework.WithFeatureGate(features.BetaDefaultOff),
|
||||
framework.WithFeatureGate(features.GA),
|
||||
framework.WithConformance(),
|
||||
framework.WithNodeConformance(),
|
||||
@@ -116,28 +117,31 @@ ERROR: bugs.go:71: trailing or leading spaces are unnecessary and need to be rem
|
||||
ERROR: bugs.go:76: WithFeature: unknown feature "no-such-feature"
|
||||
ERROR: bugs.go:78: WithEnvironment: unknown environment "no-such-env"
|
||||
ERROR: bugs.go:80: WithFeatureGate: the feature gate "no-such-feature-gate" is unknown
|
||||
ERROR: bugs.go:106: SIG label must be lowercase, no spaces and no sig- prefix, got instead: "123"
|
||||
ERROR: bugs.go:107: SIG label must be lowercase, no spaces and no sig- prefix, got instead: "123"
|
||||
ERROR: buggy/buggy.go:100: hello world
|
||||
ERROR: some/relative/path/buggy.go:200: with spaces
|
||||
`
|
||||
// Used by unittests/list-tests. It's sorted by test name, not source code location.
|
||||
ListTestsOutput = `The following spec names can be used with 'ginkgo run --focus/skip':
|
||||
../bugs/bugs.go:100: [sig-testing] abc space1 space2 [Feature:no-such-feature] [Feature:feature-foo] [Environment:no-such-env] [Environment:Linux] [FeatureGate:no-such-feature-gate] [Feature:OffByDefault] [FeatureGate:TestAlphaFeature] [Alpha] [Feature:OffByDefault] [FeatureGate:TestBetaFeature] [Beta] [FeatureGate:TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz x [foo] should [bar]
|
||||
../bugs/bugs.go:95: [sig-testing] abc space1 space2 [Feature:no-such-feature] [Feature:feature-foo] [Environment:no-such-env] [Environment:Linux] [FeatureGate:no-such-feature-gate] [Feature:OffByDefault] [FeatureGate:TestAlphaFeature] [Alpha] [Feature:OffByDefault] [FeatureGate:TestBetaFeature] [Beta] [FeatureGate:TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz y [foo] should [bar]
|
||||
../bugs/bugs.go:101: [sig-testing] abc space1 space2 [Feature:no-such-feature] [Feature:feature-foo] [Environment:no-such-env] [Environment:Linux] [FeatureGate:no-such-feature-gate] [Feature:OffByDefault] [FeatureGate:TestAlphaFeature] [Alpha] [Feature:OffByDefault] [FeatureGate:TestBetaFeature] [Beta] [FeatureGate:TestBetaDefaultOffFeature] [Beta] [Feature:OffByDefault] [FeatureGate:TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz x [foo] should [bar]
|
||||
../bugs/bugs.go:96: [sig-testing] abc space1 space2 [Feature:no-such-feature] [Feature:feature-foo] [Environment:no-such-env] [Environment:Linux] [FeatureGate:no-such-feature-gate] [Feature:OffByDefault] [FeatureGate:TestAlphaFeature] [Alpha] [Feature:OffByDefault] [FeatureGate:TestBetaFeature] [Beta] [FeatureGate:TestBetaDefaultOffFeature] [Beta] [Feature:OffByDefault] [FeatureGate:TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz y [foo] should [bar]
|
||||
|
||||
`
|
||||
|
||||
// Used by unittests/list-labels.
|
||||
ListLabelsOutput = `The following labels can be used with 'ginkgo run --label-filter':
|
||||
Alpha
|
||||
Beta
|
||||
BetaOffByDefault
|
||||
Conformance
|
||||
Disruptive
|
||||
Environment:Linux
|
||||
Environment:no-such-env
|
||||
Feature:Alpha
|
||||
Feature:Beta
|
||||
Feature:OffByDefault
|
||||
Feature:feature-foo
|
||||
Feature:no-such-feature
|
||||
FeatureGate:TestAlphaFeature
|
||||
FeatureGate:TestBetaDefaultOffFeature
|
||||
FeatureGate:TestBetaFeature
|
||||
FeatureGate:TestGAFeature
|
||||
FeatureGate:no-such-feature-gate
|
||||
|
@@ -24,9 +24,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Alpha featuregate.Feature = "TestAlphaFeature"
|
||||
Beta featuregate.Feature = "TestBetaFeature"
|
||||
GA featuregate.Feature = "TestGAFeature"
|
||||
Alpha featuregate.Feature = "TestAlphaFeature"
|
||||
Beta featuregate.Feature = "TestBetaFeature"
|
||||
BetaDefaultOff featuregate.Feature = "TestBetaDefaultOffFeature"
|
||||
GA featuregate.Feature = "TestGAFeature"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -41,6 +42,9 @@ var testFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
|
||||
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
|
||||
},
|
||||
BetaDefaultOff: {
|
||||
{Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Beta},
|
||||
},
|
||||
GA: {
|
||||
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
|
||||
|
Reference in New Issue
Block a user