@@ -20,14 +20,13 @@ import (
20
20
"testing"
21
21
22
22
"github.com/google/go-cmp/cmp"
23
+ "k8s.io/apiserver/pkg/util/feature"
23
24
"k8s.io/component-base/featuregate"
24
- "k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
25
-
26
- utilfeature "k8s.io/apiserver/pkg/util/feature"
27
25
featuregatetesting "k8s.io/component-base/featuregate/testing"
28
26
"k8s.io/kubernetes/pkg/features"
29
27
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
30
28
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultbinder"
29
+ "k8s.io/kubernetes/pkg/scheduler/framework/plugins/defaultpreemption"
31
30
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/imagelocality"
32
31
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"
33
32
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/nodeaffinity"
@@ -91,7 +90,6 @@ func TestClusterAutoscalerProvider(t *testing.T) {
91
90
{Name : interpodaffinity .Name },
92
91
{Name : podtopologyspread .Name },
93
92
{Name : tainttoleration .Name },
94
- {Name : selectorspread .Name },
95
93
},
96
94
},
97
95
Score : & schedulerapi.PluginSet {
@@ -104,7 +102,6 @@ func TestClusterAutoscalerProvider(t *testing.T) {
104
102
{Name : nodepreferavoidpods .Name , Weight : 10000 },
105
103
{Name : podtopologyspread .Name , Weight : 2 },
106
104
{Name : tainttoleration .Name , Weight : 1 },
107
- {Name : selectorspread .Name , Weight : 1 },
108
105
},
109
106
},
110
107
Reserve : & schedulerapi.PluginSet {
@@ -134,7 +131,7 @@ func TestClusterAutoscalerProvider(t *testing.T) {
134
131
func TestApplyFeatureGates (t * testing.T ) {
135
132
tests := []struct {
136
133
name string
137
- feature featuregate.Feature
134
+ features map [ featuregate.Feature ] bool
138
135
wantConfig * schedulerapi.Plugins
139
136
}{
140
137
{
@@ -183,7 +180,6 @@ func TestApplyFeatureGates(t *testing.T) {
183
180
{Name : interpodaffinity .Name },
184
181
{Name : podtopologyspread .Name },
185
182
{Name : tainttoleration .Name },
186
- {Name : selectorspread .Name },
187
183
},
188
184
},
189
185
Score : & schedulerapi.PluginSet {
@@ -196,7 +192,6 @@ func TestApplyFeatureGates(t *testing.T) {
196
192
{Name : nodepreferavoidpods .Name , Weight : 10000 },
197
193
{Name : podtopologyspread .Name , Weight : 2 },
198
194
{Name : tainttoleration .Name , Weight : 1 },
199
- {Name : selectorspread .Name , Weight : 1 },
200
195
},
201
196
},
202
197
Reserve : & schedulerapi.PluginSet {
@@ -217,8 +212,10 @@ func TestApplyFeatureGates(t *testing.T) {
217
212
},
218
213
},
219
214
{
220
- name : "NewDefaultPodTopologySpread enabled" ,
221
- feature : features .DefaultPodTopologySpread ,
215
+ name : "DefaultPodTopologySpread disabled" ,
216
+ features : map [featuregate.Feature ]bool {
217
+ features .DefaultPodTopologySpread : false ,
218
+ },
222
219
wantConfig : & schedulerapi.Plugins {
223
220
QueueSort : & schedulerapi.PluginSet {
224
221
Enabled : []schedulerapi.Plugin {
@@ -263,6 +260,7 @@ func TestApplyFeatureGates(t *testing.T) {
263
260
{Name : interpodaffinity .Name },
264
261
{Name : podtopologyspread .Name },
265
262
{Name : tainttoleration .Name },
263
+ {Name : selectorspread .Name },
266
264
},
267
265
},
268
266
Score : & schedulerapi.PluginSet {
@@ -275,6 +273,7 @@ func TestApplyFeatureGates(t *testing.T) {
275
273
{Name : nodepreferavoidpods .Name , Weight : 10000 },
276
274
{Name : podtopologyspread .Name , Weight : 2 },
277
275
{Name : tainttoleration .Name , Weight : 1 },
276
+ {Name : selectorspread .Name , Weight : 1 },
278
277
},
279
278
},
280
279
Reserve : & schedulerapi.PluginSet {
@@ -298,8 +297,8 @@ func TestApplyFeatureGates(t *testing.T) {
298
297
299
298
for _ , test := range tests {
300
299
t .Run (test .name , func (t * testing.T ) {
301
- if test . feature != "" {
302
- defer featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , test . feature , true )()
300
+ for k , v := range test . features {
301
+ defer featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , k , v )()
303
302
}
304
303
305
304
r := NewRegistry ()
0 commit comments