diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go index 53e270c2ab7..3a17cb28dd7 100644 --- a/pkg/scheduler/framework/runtime/framework.go +++ b/pkg/scheduler/framework/runtime/framework.go @@ -730,11 +730,10 @@ func (f *frameworkImpl) RunFilterPlugins( if !pluginStatus.IsUnschedulable() { // Filter plugins are not supposed to return any status other than // Success or Unschedulable. - errStatus := framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError())).WithFailedPlugin(pl.Name()) - return map[string]*framework.Status{pl.Name(): errStatus} + pluginStatus = framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError())) } pluginStatus.SetFailedPlugin(pl.Name()) - statuses[pl.Name()] = pluginStatus + return map[string]*framework.Status{pl.Name(): pluginStatus} } } diff --git a/pkg/scheduler/framework/runtime/framework_test.go b/pkg/scheduler/framework/runtime/framework_test.go index ddb7a251a5f..5363b56b9f6 100644 --- a/pkg/scheduler/framework/runtime/framework_test.go +++ b/pkg/scheduler/framework/runtime/framework_test.go @@ -1506,7 +1506,6 @@ func TestFilterPlugins(t *testing.T) { name: "TestPlugin1", inj: injectedResult{FilterStatus: int(framework.Error)}, }, - { name: "TestPlugin2", inj: injectedResult{FilterStatus: int(framework.Error)}, @@ -1517,6 +1516,23 @@ func TestFilterPlugins(t *testing.T) { "TestPlugin1": framework.AsStatus(fmt.Errorf(`running "TestPlugin1" filter plugin: %w`, errInjectedFilterStatus)).WithFailedPlugin("TestPlugin1"), }, }, + { + name: "UnschedulableAndUnschedulableFilters", + plugins: []*TestPlugin{ + { + name: "TestPlugin1", + inj: injectedResult{FilterStatus: int(framework.Unschedulable)}, + }, + { + name: "TestPlugin2", + inj: injectedResult{FilterStatus: int(framework.Unschedulable)}, + }, + }, + wantStatus: framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"), + wantStatusMap: framework.PluginToStatus{ + "TestPlugin1": framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"), + }, + }, { name: "SuccessAndSuccessFilters", plugins: []*TestPlugin{