mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-05 15:37:35 +00:00
Distinguish unschedulable with unresolvable in scheduler
Before, in RunPostFilterPlugins, we didn't distinguish between unschedulable and unresolvable because we only have one postFilterPlugin by default, now, we have at least two, we should make sure that once a postFilterPlugin returns unresolvable, we'll return directly Signed-off-by: Kante Yin <kerthcet@gmail.com>
This commit is contained in:
@@ -139,43 +139,6 @@ func assertStatusCode(t *testing.T, code Code, value int) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPluginToStatusMerge(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
statusMap PluginToStatus
|
||||
wantCode Code
|
||||
}{
|
||||
{
|
||||
name: "merge Error and Unschedulable statuses",
|
||||
statusMap: PluginToStatus{"p1": NewStatus(Error), "p2": NewStatus(Unschedulable)},
|
||||
wantCode: Error,
|
||||
},
|
||||
{
|
||||
name: "merge Success and Unschedulable statuses",
|
||||
statusMap: PluginToStatus{"p1": NewStatus(Success), "p2": NewStatus(Unschedulable)},
|
||||
wantCode: Unschedulable,
|
||||
},
|
||||
{
|
||||
name: "merge Success, UnschedulableAndUnresolvable and Unschedulable statuses",
|
||||
statusMap: PluginToStatus{"p1": NewStatus(Success), "p2": NewStatus(UnschedulableAndUnresolvable), "p3": NewStatus(Unschedulable)},
|
||||
wantCode: UnschedulableAndUnresolvable,
|
||||
},
|
||||
{
|
||||
name: "merge nil status",
|
||||
wantCode: Success,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
gotStatus := test.statusMap.Merge()
|
||||
if test.wantCode != gotStatus.Code() {
|
||||
t.Errorf("wantCode %v, gotCode %v", test.wantCode, gotStatus.Code())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreFilterResultMerge(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
receiver *PreFilterResult
|
||||
|
||||
Reference in New Issue
Block a user