@@ -935,6 +935,7 @@ func TestSchedulerNoPhantomPodAfterDelete(t *testing.T) {
935
935
node .Name : framework .NewStatus (framework .Unschedulable , nodeports .ErrReason ).WithPlugin (nodeports .Name ),
936
936
},
937
937
UnschedulablePlugins : sets .New (nodeports .Name ),
938
+ EvaluatedNodes : 1 ,
938
939
},
939
940
}
940
941
if ! reflect .DeepEqual (expectErr , err ) {
@@ -1042,6 +1043,7 @@ func TestSchedulerFailedSchedulingReasons(t *testing.T) {
1042
1043
Diagnosis : framework.Diagnosis {
1043
1044
NodeToStatusMap : failedNodeStatues ,
1044
1045
UnschedulablePlugins : sets .New (noderesources .Name ),
1046
+ EvaluatedNodes : 100 ,
1045
1047
},
1046
1048
}
1047
1049
if len (fmt .Sprint (expectErr )) > 150 {
@@ -1829,6 +1831,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
1829
1831
"node2" : framework .NewStatus (framework .Unschedulable , tf .ErrReasonFake ).WithPlugin ("FalseFilter" ),
1830
1832
},
1831
1833
UnschedulablePlugins : sets .New ("FalseFilter" ),
1834
+ EvaluatedNodes : 2 ,
1832
1835
},
1833
1836
},
1834
1837
},
@@ -1919,6 +1922,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
1919
1922
"1" : framework .NewStatus (framework .Unschedulable , tf .ErrReasonFake ).WithPlugin ("FalseFilter" ),
1920
1923
},
1921
1924
UnschedulablePlugins : sets .New ("FalseFilter" ),
1925
+ EvaluatedNodes : 3 ,
1922
1926
},
1923
1927
},
1924
1928
},
@@ -1945,6 +1949,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
1945
1949
"2" : framework .NewStatus (framework .Unschedulable , tf .ErrReasonFake ).WithPlugin ("NoPodsFilter" ),
1946
1950
},
1947
1951
UnschedulablePlugins : sets .New ("MatchFilter" , "NoPodsFilter" ),
1952
+ EvaluatedNodes : 2 ,
1948
1953
},
1949
1954
},
1950
1955
},
@@ -2110,6 +2115,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2110
2115
"3" : framework .NewStatus (framework .Unschedulable , "injecting failure for pod test-filter" ).WithPlugin ("FakeFilter" ),
2111
2116
},
2112
2117
UnschedulablePlugins : sets .New ("FakeFilter" ),
2118
+ EvaluatedNodes : 1 ,
2113
2119
},
2114
2120
},
2115
2121
},
@@ -2143,6 +2149,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2143
2149
"3" : framework .NewStatus (framework .Unschedulable , "injecting failure for pod test-filter" ).WithPlugin ("FakeFilter" ),
2144
2150
},
2145
2151
UnschedulablePlugins : sets .New ("FakeFilter" , framework .ExtenderName ),
2152
+ EvaluatedNodes : 3 ,
2146
2153
},
2147
2154
},
2148
2155
},
@@ -2168,6 +2175,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2168
2175
"3" : framework .NewStatus (framework .UnschedulableAndUnresolvable , "injecting failure for pod test-filter" ).WithPlugin ("FakeFilter" ),
2169
2176
},
2170
2177
UnschedulablePlugins : sets .New ("FakeFilter" ),
2178
+ EvaluatedNodes : 1 ,
2171
2179
},
2172
2180
},
2173
2181
},
@@ -2249,7 +2257,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2249
2257
nodes : []string {"node1" , "node2" , "node3" },
2250
2258
pod : st .MakePod ().Name ("test-prefilter" ).UID ("test-prefilter" ).Obj (),
2251
2259
wantNodes : sets .New ("node2" ),
2252
- wantEvaluatedNodes : ptr.To [int32 ](3 ),
2260
+ wantEvaluatedNodes : ptr.To [int32 ](1 ),
2253
2261
},
2254
2262
{
2255
2263
name : "test prefilter plugin returning non-intersecting nodes" ,
@@ -2338,6 +2346,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2338
2346
"node2" : framework .NewStatus (framework .Unschedulable , "injecting failure for pod test-prefilter" ).WithPlugin ("FakeFilter" ),
2339
2347
},
2340
2348
UnschedulablePlugins : sets .New ("FakeFilter" ),
2349
+ EvaluatedNodes : 1 ,
2341
2350
PreFilterMsg : "" ,
2342
2351
},
2343
2352
},
@@ -2416,10 +2425,11 @@ func TestSchedulerSchedulePod(t *testing.T) {
2416
2425
),
2417
2426
tf .RegisterBindPlugin (defaultbinder .Name , defaultbinder .New ),
2418
2427
},
2419
- nodes : []string {"node1" , "node2" , "node3" },
2420
- pod : st .MakePod ().Name ("test-prefilter" ).UID ("test-prefilter" ).Obj (),
2421
- wantNodes : sets .New ("node1" , "node2" ),
2422
- wantEvaluatedNodes : ptr.To [int32 ](2 ),
2428
+ nodes : []string {"node1" , "node2" , "node3" },
2429
+ pod : st .MakePod ().Name ("test-prefilter" ).UID ("test-prefilter" ).Obj (),
2430
+ wantNodes : sets .New ("node1" , "node2" ),
2431
+ // since this case has no score plugin, we'll only try to find one node in Filter stage
2432
+ wantEvaluatedNodes : ptr.To [int32 ](1 ),
2423
2433
},
2424
2434
}
2425
2435
for _ , test := range tests {
@@ -2483,7 +2493,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2483
2493
if gotOK != wantOK {
2484
2494
t .Errorf ("Expected err to be FitError: %v, but got %v (error: %v)" , wantOK , gotOK , err )
2485
2495
} else if gotOK {
2486
- if diff := cmp .Diff (gotFitErr , wantFitErr ); diff != "" {
2496
+ if diff := cmp .Diff (wantFitErr , gotFitErr ); diff != "" {
2487
2497
t .Errorf ("Unexpected fitErr: (-want, +got): %s" , diff )
2488
2498
}
2489
2499
}
@@ -2536,6 +2546,7 @@ func TestFindFitAllError(t *testing.T) {
2536
2546
"3" : framework .NewStatus (framework .Unschedulable , tf .ErrReasonFake ).WithPlugin ("MatchFilter" ),
2537
2547
},
2538
2548
UnschedulablePlugins : sets .New ("MatchFilter" ),
2549
+ EvaluatedNodes : 3 ,
2539
2550
}
2540
2551
if diff := cmp .Diff (diagnosis , expected ); diff != "" {
2541
2552
t .Errorf ("Unexpected diagnosis: (-want, +got): %s" , diff )
0 commit comments