Skip to content

Commit a2c739f

Browse files
committed
chore: [e2e/framework] Updates test feature gates to versioned feature gates
1 parent 7b5cbbb commit a2c739f

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ ERROR: some/relative/path/buggy.go:200: with spaces
122122
`
123123
// Used by unittests/list-tests. It's sorted by test name, not source code location.
124124
ListTestsOutput = `The following spec names can be used with 'ginkgo run --focus/skip':
125-
../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] [Feature:OffByDefault] [FeatureGate:TestGAFeature] [Feature:OffByDefault] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz x [foo] should [bar]
126-
../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] [Feature:OffByDefault] [FeatureGate:TestGAFeature] [Feature:OffByDefault] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz y [foo] should [bar]
125+
../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]
126+
../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]
127127
128128
`
129129

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package features
1818

1919
import (
2020
"k8s.io/apimachinery/pkg/util/runtime"
21+
"k8s.io/apimachinery/pkg/util/version"
2122
utilfeature "k8s.io/apiserver/pkg/util/feature"
2223
"k8s.io/component-base/featuregate"
2324
)
@@ -29,11 +30,20 @@ const (
2930
)
3031

3132
func init() {
32-
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(testFeatureGates)) //nolint:forbidigo // Part of a unit test.
33+
runtime.Must(utilfeature.DefaultMutableFeatureGate.AddVersioned(testFeatureGates))
3334
}
3435

35-
var testFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
36-
Alpha: {PreRelease: featuregate.Alpha},
37-
Beta: {PreRelease: featuregate.Beta},
38-
GA: {PreRelease: featuregate.GA},
36+
var testFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
37+
Alpha: {
38+
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
39+
},
40+
Beta: {
41+
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
42+
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
43+
},
44+
GA: {
45+
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
46+
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
47+
{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
48+
},
3949
}

test/e2e/framework/internal/unittests/features/kube_features.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package features
1818

1919
import (
2020
"k8s.io/apimachinery/pkg/util/runtime"
21+
"k8s.io/apimachinery/pkg/util/version"
2122
utilfeature "k8s.io/apiserver/pkg/util/feature"
2223
"k8s.io/component-base/featuregate"
2324
)
@@ -27,9 +28,12 @@ const (
2728
)
2829

2930
func init() {
30-
runtime.Must(utilfeature.DefaultMutableFeatureGate.Add(defaultKubernetesFeatureGates)) //nolint:forbidigo // Part of a unit test.
31+
runtime.Must(utilfeature.DefaultMutableFeatureGate.AddVersioned(defaultVersionedKubernetesFeatureGates))
3132
}
3233

33-
var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
34-
Test: {Default: false, PreRelease: featuregate.Alpha},
34+
var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{
35+
Test: {
36+
{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
37+
{Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta},
38+
},
3539
}

0 commit comments

Comments
 (0)