@@ -47,9 +47,7 @@ func TestNewTopologyManagerOptions(t *testing.T) {
47
47
expectedOptions PolicyOptions
48
48
}{
49
49
{
50
- description : "return TopologyManagerOptions with PreferClosestNUMA set to true" ,
51
- featureGate : pkgfeatures .TopologyManagerPolicyBetaOptions ,
52
- featureGateEnable : true ,
50
+ description : "return TopologyManagerOptions with PreferClosestNUMA set to true" ,
53
51
expectedOptions : PolicyOptions {
54
52
PreferClosestNUMA : true ,
55
53
MaxAllowableNUMANodes : 8 ,
@@ -74,8 +72,7 @@ func TestNewTopologyManagerOptions(t *testing.T) {
74
72
description : "fail to set option when TopologyManagerPolicyBetaOptions feature gate is not set" ,
75
73
featureGate : pkgfeatures .TopologyManagerPolicyBetaOptions ,
76
74
policyOptions : map [string ]string {
77
- PreferClosestNUMANodes : "true" ,
78
- MaxAllowableNUMANodes : "8" ,
75
+ MaxAllowableNUMANodes : "8" ,
79
76
},
80
77
expectedErr : fmt .Errorf ("Topology Manager Policy Beta-level Options not enabled," ),
81
78
},
@@ -87,7 +84,6 @@ func TestNewTopologyManagerOptions(t *testing.T) {
87
84
},
88
85
{
89
86
description : "fail to parse options with error PreferClosestNUMANodes" ,
90
- featureGate : pkgfeatures .TopologyManagerPolicyAlphaOptions ,
91
87
featureGateEnable : true ,
92
88
policyOptions : map [string ]string {
93
89
PreferClosestNUMANodes : "not a boolean" ,
@@ -177,6 +173,10 @@ func TestPolicyDefaultsAvailable(t *testing.T) {
177
173
option : PreferClosestNUMANodes ,
178
174
expectedAvailable : true ,
179
175
},
176
+ {
177
+ option : MaxAllowableNUMANodes ,
178
+ expectedAvailable : true ,
179
+ },
180
180
}
181
181
for _ , testCase := range testCases {
182
182
t .Run (testCase .option , func (t * testing.T ) {
@@ -206,7 +206,7 @@ func TestPolicyOptionsAvailable(t *testing.T) {
206
206
{
207
207
option : PreferClosestNUMANodes ,
208
208
featureGate : pkgfeatures .TopologyManagerPolicyBetaOptions ,
209
- featureGateEnable : true ,
209
+ featureGateEnable : false ,
210
210
expectedAvailable : true ,
211
211
},
212
212
{
@@ -215,10 +215,40 @@ func TestPolicyOptionsAvailable(t *testing.T) {
215
215
featureGateEnable : false ,
216
216
expectedAvailable : true ,
217
217
},
218
+ {
219
+ option : fancyAlphaOption ,
220
+ featureGate : pkgfeatures .TopologyManagerPolicyAlphaOptions ,
221
+ featureGateEnable : true ,
222
+ expectedAvailable : true ,
223
+ },
224
+ {
225
+ option : fancyAlphaOption ,
226
+ featureGate : pkgfeatures .TopologyManagerPolicyAlphaOptions ,
227
+ featureGateEnable : false ,
228
+ expectedAvailable : false ,
229
+ },
230
+ {
231
+ option : fancyBetaOption ,
232
+ featureGate : pkgfeatures .TopologyManagerPolicyBetaOptions ,
233
+ featureGateEnable : true ,
234
+ expectedAvailable : true ,
235
+ },
236
+ {
237
+ option : fancyBetaOption ,
238
+ featureGate : pkgfeatures .TopologyManagerPolicyBetaOptions ,
239
+ featureGateEnable : false ,
240
+ expectedAvailable : false ,
241
+ },
218
242
}
243
+ betaOptions .Insert (fancyBetaOption )
244
+ alphaOptions .Insert (fancyAlphaOption )
219
245
for _ , testCase := range testCases {
220
246
t .Run (testCase .option , func (t * testing.T ) {
221
247
featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , testCase .featureGate , testCase .featureGateEnable )
248
+ defer func () {
249
+ // reset feature flag
250
+ featuregatetesting .SetFeatureGateDuringTest (t , utilfeature .DefaultFeatureGate , testCase .featureGate , ! testCase .featureGateEnable )
251
+ }()
222
252
err := CheckPolicyOptionAvailable (testCase .option )
223
253
isEnabled := (err == nil )
224
254
if isEnabled != testCase .expectedAvailable {
0 commit comments