@@ -273,14 +273,14 @@ func TestSchedulePlugins(t *testing.T) {
273
273
{
274
274
name : "all plugins executed successfully, all scorers with same weight" ,
275
275
config : SchedulerConfig {
276
- PreSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
277
- Filters : []plugins.Filter {tp1 , tp2 },
278
- Scorers : map [plugins.Scorer ]int {
276
+ preSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
277
+ filters : []plugins.Filter {tp1 , tp2 },
278
+ scorers : map [plugins.Scorer ]int {
279
279
tp1 : 1 ,
280
280
tp2 : 1 ,
281
281
},
282
- Picker : pickerPlugin ,
283
- PostSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
282
+ picker : pickerPlugin ,
283
+ postSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
284
284
},
285
285
input : []* backendmetrics.FakePodMetrics {
286
286
{Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
@@ -295,14 +295,14 @@ func TestSchedulePlugins(t *testing.T) {
295
295
{
296
296
name : "all plugins executed successfully, different scorers weights" ,
297
297
config : SchedulerConfig {
298
- PreSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
299
- Filters : []plugins.Filter {tp1 , tp2 },
300
- Scorers : map [plugins.Scorer ]int {
298
+ preSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
299
+ filters : []plugins.Filter {tp1 , tp2 },
300
+ scorers : map [plugins.Scorer ]int {
301
301
tp1 : 60 ,
302
302
tp2 : 40 ,
303
303
},
304
- Picker : pickerPlugin ,
305
- PostSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
304
+ picker : pickerPlugin ,
305
+ postSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
306
306
},
307
307
input : []* backendmetrics.FakePodMetrics {
308
308
{Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
@@ -317,14 +317,14 @@ func TestSchedulePlugins(t *testing.T) {
317
317
{
318
318
name : "filter all" ,
319
319
config : SchedulerConfig {
320
- PreSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
321
- Filters : []plugins.Filter {tp1 , tp_filterAll },
322
- Scorers : map [plugins.Scorer ]int {
320
+ preSchedulePlugins : []plugins.PreSchedule {tp1 , tp2 },
321
+ filters : []plugins.Filter {tp1 , tp_filterAll },
322
+ scorers : map [plugins.Scorer ]int {
323
323
tp1 : 1 ,
324
324
tp2 : 1 ,
325
325
},
326
- Picker : pickerPlugin ,
327
- PostSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
326
+ picker : pickerPlugin ,
327
+ postSchedulePlugins : []plugins.PostSchedule {tp1 , tp2 },
328
328
},
329
329
input : []* backendmetrics.FakePodMetrics {
330
330
{Pod : & backend.Pod {NamespacedName : k8stypes.NamespacedName {Name : "pod1" }}},
@@ -339,17 +339,17 @@ func TestSchedulePlugins(t *testing.T) {
339
339
for _ , test := range tests {
340
340
t .Run (test .name , func (t * testing.T ) {
341
341
// Reset all plugins before each new test case.
342
- for _ , plugin := range test .config .PreSchedulePlugins {
342
+ for _ , plugin := range test .config .preSchedulePlugins {
343
343
plugin .(* TestPlugin ).reset ()
344
344
}
345
- for _ , plugin := range test .config .Filters {
345
+ for _ , plugin := range test .config .filters {
346
346
plugin .(* TestPlugin ).reset ()
347
347
}
348
- for plugin := range test .config .Scorers {
348
+ for plugin := range test .config .scorers {
349
349
plugin .(* TestPlugin ).reset ()
350
350
}
351
- test .config .Picker .(* TestPlugin ).reset ()
352
- for _ , plugin := range test .config .PostSchedulePlugins {
351
+ test .config .picker .(* TestPlugin ).reset ()
352
+ for _ , plugin := range test .config .postSchedulePlugins {
353
353
plugin .(* TestPlugin ).reset ()
354
354
}
355
355
@@ -378,21 +378,21 @@ func TestSchedulePlugins(t *testing.T) {
378
378
}
379
379
380
380
// Validate plugin execution counts dynamically
381
- for _ , plugin := range test .config .PreSchedulePlugins {
381
+ for _ , plugin := range test .config .preSchedulePlugins {
382
382
tp , _ := plugin .(* TestPlugin )
383
383
if tp .PreScheduleCallCount != 1 {
384
384
t .Errorf ("Plugin %s PreSchedule() called %d times, expected 1" , plugin .Name (), tp .PreScheduleCallCount )
385
385
}
386
386
}
387
387
388
- for _ , plugin := range test .config .Filters {
388
+ for _ , plugin := range test .config .filters {
389
389
tp , _ := plugin .(* TestPlugin )
390
390
if tp .FilterCallCount != 1 {
391
391
t .Errorf ("Plugin %s Filter() called %d times, expected 1" , plugin .Name (), tp .FilterCallCount )
392
392
}
393
393
}
394
394
395
- for plugin := range test .config .Scorers {
395
+ for plugin := range test .config .scorers {
396
396
tp , _ := plugin .(* TestPlugin )
397
397
if tp .ScoreCallCount != 1 {
398
398
t .Errorf ("Plugin %s Score() called %d times, expected 1" , plugin .Name (), tp .ScoreCallCount )
@@ -402,7 +402,7 @@ func TestSchedulePlugins(t *testing.T) {
402
402
}
403
403
}
404
404
405
- tp , _ := test .config .Picker .(* TestPlugin )
405
+ tp , _ := test .config .picker .(* TestPlugin )
406
406
if tp .NumOfPickerCandidates != test .numPodsToScore {
407
407
t .Errorf ("Picker plugin %s Pick() called with %d candidates, expected %d" , tp .Name (), tp .NumOfPickerCandidates , tp .NumOfScoredPods )
408
408
}
@@ -413,7 +413,7 @@ func TestSchedulePlugins(t *testing.T) {
413
413
t .Errorf ("winnder pod score %v, expected %v" , tp .WinnderPodScore , test .targetPodScore )
414
414
}
415
415
416
- for _ , plugin := range test .config .PostSchedulePlugins {
416
+ for _ , plugin := range test .config .postSchedulePlugins {
417
417
tp , _ := plugin .(* TestPlugin )
418
418
if tp .PostScheduleCallCount != 1 {
419
419
t .Errorf ("Plugin %s PostSchedule() called %d times, expected 1" , plugin .Name (), tp .PostScheduleCallCount )
0 commit comments