@@ -37,10 +37,11 @@ import (
37
37
func TestCompatibility_v1_Scheduler (t * testing.T ) {
38
38
// Add serialized versions of scheduler config that exercise available options to ensure compatibility between releases
39
39
schedulerFiles := map [string ]struct {
40
- JSON string
41
- wantPredicates sets.String
42
- wantPrioritizers sets.String
43
- wantExtenders []schedulerapi.ExtenderConfig
40
+ JSON string
41
+ wantPredicates sets.String
42
+ wantPrioritizers sets.String
43
+ wantFilterPlugins sets.String
44
+ wantExtenders []schedulerapi.ExtenderConfig
44
45
}{
45
46
// Do not change this JSON after the corresponding release has been tagged.
46
47
// A failure indicates backwards compatibility with the specified release was broken.
@@ -214,7 +215,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
214
215
"HostName" ,
215
216
"NoDiskConflict" ,
216
217
"NoVolumeZoneConflict" ,
217
- "PodToleratesNodeTaints" ,
218
218
"CheckNodeMemoryPressure" ,
219
219
"MaxEBSVolumeCount" ,
220
220
"MaxGCEPDVolumeCount" ,
@@ -234,6 +234,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
234
234
"TaintTolerationPriority" ,
235
235
"InterPodAffinityPriority" ,
236
236
),
237
+ wantFilterPlugins : sets .NewString (
238
+ "TaintToleration" ,
239
+ ),
237
240
},
238
241
239
242
// Do not change this JSON after the corresponding release has been tagged.
@@ -279,7 +282,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
279
282
"HostName" ,
280
283
"NoDiskConflict" ,
281
284
"NoVolumeZoneConflict" ,
282
- "PodToleratesNodeTaints" ,
283
285
"CheckNodeMemoryPressure" ,
284
286
"CheckNodeDiskPressure" ,
285
287
"MaxEBSVolumeCount" ,
@@ -302,6 +304,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
302
304
"InterPodAffinityPriority" ,
303
305
"MostRequestedPriority" ,
304
306
),
307
+ wantFilterPlugins : sets .NewString (
308
+ "TaintToleration" ,
309
+ ),
305
310
},
306
311
// Do not change this JSON after the corresponding release has been tagged.
307
312
// A failure indicates backwards compatibility with the specified release was broken.
@@ -356,7 +361,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
356
361
"HostName" ,
357
362
"NoDiskConflict" ,
358
363
"NoVolumeZoneConflict" ,
359
- "PodToleratesNodeTaints" ,
360
364
"CheckNodeMemoryPressure" ,
361
365
"CheckNodeDiskPressure" ,
362
366
"MaxEBSVolumeCount" ,
@@ -379,6 +383,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
379
383
"InterPodAffinityPriority" ,
380
384
"MostRequestedPriority" ,
381
385
),
386
+ wantFilterPlugins : sets .NewString (
387
+ "TaintToleration" ,
388
+ ),
382
389
wantExtenders : []schedulerapi.ExtenderConfig {{
383
390
URLPrefix : "/prefix" ,
384
391
FilterVerb : "filter" ,
@@ -445,7 +452,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
445
452
"HostName" ,
446
453
"NoDiskConflict" ,
447
454
"NoVolumeZoneConflict" ,
448
- "PodToleratesNodeTaints" ,
449
455
"CheckNodeMemoryPressure" ,
450
456
"CheckNodeDiskPressure" ,
451
457
"CheckNodeCondition" ,
@@ -469,6 +475,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
469
475
"InterPodAffinityPriority" ,
470
476
"MostRequestedPriority" ,
471
477
),
478
+ wantFilterPlugins : sets .NewString (
479
+ "TaintToleration" ,
480
+ ),
472
481
wantExtenders : []schedulerapi.ExtenderConfig {{
473
482
URLPrefix : "/prefix" ,
474
483
FilterVerb : "filter" ,
@@ -536,7 +545,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
536
545
"HostName" ,
537
546
"NoDiskConflict" ,
538
547
"NoVolumeZoneConflict" ,
539
- "PodToleratesNodeTaints" ,
540
548
"CheckNodeMemoryPressure" ,
541
549
"CheckNodeDiskPressure" ,
542
550
"CheckNodeCondition" ,
@@ -561,6 +569,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
561
569
"InterPodAffinityPriority" ,
562
570
"MostRequestedPriority" ,
563
571
),
572
+ wantFilterPlugins : sets .NewString (
573
+ "TaintToleration" ,
574
+ ),
564
575
wantExtenders : []schedulerapi.ExtenderConfig {{
565
576
URLPrefix : "/prefix" ,
566
577
FilterVerb : "filter" ,
@@ -632,7 +643,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
632
643
"HostName" ,
633
644
"NoDiskConflict" ,
634
645
"NoVolumeZoneConflict" ,
635
- "PodToleratesNodeTaints" ,
636
646
"CheckNodeMemoryPressure" ,
637
647
"CheckNodeDiskPressure" ,
638
648
"CheckNodePIDPressure" ,
@@ -658,6 +668,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
658
668
"InterPodAffinityPriority" ,
659
669
"MostRequestedPriority" ,
660
670
),
671
+ wantFilterPlugins : sets .NewString (
672
+ "TaintToleration" ,
673
+ ),
661
674
wantExtenders : []schedulerapi.ExtenderConfig {{
662
675
URLPrefix : "/prefix" ,
663
676
FilterVerb : "filter" ,
@@ -741,7 +754,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
741
754
"HostName" ,
742
755
"NoDiskConflict" ,
743
756
"NoVolumeZoneConflict" ,
744
- "PodToleratesNodeTaints" ,
745
757
"CheckNodeMemoryPressure" ,
746
758
"CheckNodeDiskPressure" ,
747
759
"CheckNodePIDPressure" ,
@@ -768,6 +780,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
768
780
"MostRequestedPriority" ,
769
781
"RequestedToCapacityRatioPriority" ,
770
782
),
783
+ wantFilterPlugins : sets .NewString (
784
+ "TaintToleration" ,
785
+ ),
771
786
wantExtenders : []schedulerapi.ExtenderConfig {{
772
787
URLPrefix : "/prefix" ,
773
788
FilterVerb : "filter" ,
@@ -852,7 +867,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
852
867
"HostName" ,
853
868
"NoDiskConflict" ,
854
869
"NoVolumeZoneConflict" ,
855
- "PodToleratesNodeTaints" ,
856
870
"CheckNodeMemoryPressure" ,
857
871
"CheckNodeDiskPressure" ,
858
872
"CheckNodePIDPressure" ,
@@ -880,6 +894,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
880
894
"MostRequestedPriority" ,
881
895
"RequestedToCapacityRatioPriority" ,
882
896
),
897
+ wantFilterPlugins : sets .NewString (
898
+ "TaintToleration" ,
899
+ ),
883
900
wantExtenders : []schedulerapi.ExtenderConfig {{
884
901
URLPrefix : "/prefix" ,
885
902
FilterVerb : "filter" ,
@@ -963,7 +980,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
963
980
"HostName" ,
964
981
"NoDiskConflict" ,
965
982
"NoVolumeZoneConflict" ,
966
- "PodToleratesNodeTaints" ,
967
983
"CheckNodeMemoryPressure" ,
968
984
"CheckNodeDiskPressure" ,
969
985
"CheckNodePIDPressure" ,
@@ -992,6 +1008,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
992
1008
"MostRequestedPriority" ,
993
1009
"RequestedToCapacityRatioPriority" ,
994
1010
),
1011
+ wantFilterPlugins : sets .NewString (
1012
+ "TaintToleration" ,
1013
+ ),
995
1014
wantExtenders : []schedulerapi.ExtenderConfig {{
996
1015
URLPrefix : "/prefix" ,
997
1016
FilterVerb : "filter" ,
@@ -1079,7 +1098,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
1079
1098
"HostName" ,
1080
1099
"NoDiskConflict" ,
1081
1100
"NoVolumeZoneConflict" ,
1082
- "PodToleratesNodeTaints" ,
1083
1101
"CheckNodeMemoryPressure" ,
1084
1102
"CheckNodeDiskPressure" ,
1085
1103
"CheckNodePIDPressure" ,
@@ -1108,6 +1126,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
1108
1126
"MostRequestedPriority" ,
1109
1127
"RequestedToCapacityRatioPriority" ,
1110
1128
),
1129
+ wantFilterPlugins : sets .NewString (
1130
+ "TaintToleration" ,
1131
+ ),
1111
1132
wantExtenders : []schedulerapi.ExtenderConfig {{
1112
1133
URLPrefix : "/prefix" ,
1113
1134
FilterVerb : "filter" ,
@@ -1128,6 +1149,9 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
1128
1149
seenPredicates := sets .NewString ()
1129
1150
seenPriorities := sets .NewString ()
1130
1151
mandatoryPredicates := sets .NewString ("CheckNodeCondition" )
1152
+ filterToPredicateMap := map [string ]string {
1153
+ "TaintToleration" : "PodToleratesNodeTaints" ,
1154
+ }
1131
1155
1132
1156
for v , tc := range schedulerFiles {
1133
1157
t .Run (v , func (t * testing.T ) {
@@ -1163,26 +1187,39 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
1163
1187
algorithmSrc ,
1164
1188
make (chan struct {}),
1165
1189
)
1190
+
1166
1191
if err != nil {
1167
1192
t .Fatalf ("%s: Error constructing: %v" , v , err )
1168
1193
}
1169
- schedPredicates := sets .NewString ()
1194
+ gotPredicates := sets .NewString ()
1170
1195
for p := range sched .Algorithm .Predicates () {
1171
- schedPredicates .Insert (p )
1196
+ gotPredicates .Insert (p )
1172
1197
}
1173
1198
wantPredicates := tc .wantPredicates .Union (mandatoryPredicates )
1174
- if ! schedPredicates .Equal (wantPredicates ) {
1175
- t .Errorf ("Got predicates %v, want %v" , schedPredicates , wantPredicates )
1199
+ if ! gotPredicates .Equal (wantPredicates ) {
1200
+ t .Errorf ("Got predicates %v, want %v" , gotPredicates , wantPredicates )
1176
1201
}
1177
- schedPrioritizers := sets .NewString ()
1202
+
1203
+ gotPrioritizers := sets .NewString ()
1178
1204
for _ , p := range sched .Algorithm .Prioritizers () {
1179
- schedPrioritizers .Insert (p .Name )
1205
+ gotPrioritizers .Insert (p .Name )
1206
+ }
1207
+ if ! gotPrioritizers .Equal (tc .wantPrioritizers ) {
1208
+ t .Errorf ("Got prioritizers %v, want %v" , gotPrioritizers , tc .wantPrioritizers )
1180
1209
}
1181
1210
1182
- if ! schedPrioritizers .Equal (tc .wantPrioritizers ) {
1183
- t .Errorf ("Got prioritizers %v, want %v" , schedPrioritizers , tc .wantPrioritizers )
1211
+ gotFilterPlugins := sets .NewString ()
1212
+ plugins := sched .Framework .ListPlugins ()
1213
+ for _ , p := range plugins ["FilterPlugin" ] {
1214
+ gotFilterPlugins .Insert (p )
1215
+ seenPredicates .Insert (filterToPredicateMap [p ])
1216
+
1217
+ }
1218
+ if ! gotFilterPlugins .Equal (tc .wantFilterPlugins ) {
1219
+ t .Errorf ("Got filter plugins %v, want %v" , gotFilterPlugins , tc .wantFilterPlugins )
1184
1220
}
1185
- schedExtenders := sched .Algorithm .Extenders ()
1221
+
1222
+ gotExtenders := sched .Algorithm .Extenders ()
1186
1223
var wantExtenders []* core.HTTPExtender
1187
1224
for _ , e := range tc .wantExtenders {
1188
1225
extender , err := core .NewHTTPExtender (& e )
@@ -1191,13 +1228,14 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
1191
1228
}
1192
1229
wantExtenders = append (wantExtenders , extender .(* core.HTTPExtender ))
1193
1230
}
1194
- for i := range schedExtenders {
1195
- if ! core .Equal (wantExtenders [i ], schedExtenders [i ].(* core.HTTPExtender )) {
1196
- t .Errorf ("Got extender #%d %+v, want %+v" , i , schedExtenders [i ], wantExtenders [i ])
1231
+ for i := range gotExtenders {
1232
+ if ! core .Equal (wantExtenders [i ], gotExtenders [i ].(* core.HTTPExtender )) {
1233
+ t .Errorf ("Got extender #%d %+v, want %+v" , i , gotExtenders [i ], wantExtenders [i ])
1197
1234
}
1198
1235
}
1199
- seenPredicates = seenPredicates .Union (schedPredicates )
1200
- seenPriorities = seenPriorities .Union (schedPrioritizers )
1236
+
1237
+ seenPredicates = seenPredicates .Union (gotPredicates )
1238
+ seenPriorities = seenPriorities .Union (gotPrioritizers )
1201
1239
})
1202
1240
}
1203
1241
0 commit comments