diff --git a/pkg/scheduler/framework/v1alpha1/framework_test.go b/pkg/scheduler/framework/v1alpha1/framework_test.go index b3a0ef82754..40aa696ca0f 100644 --- a/pkg/scheduler/framework/v1alpha1/framework_test.go +++ b/pkg/scheduler/framework/v1alpha1/framework_test.go @@ -470,11 +470,13 @@ func recordingPluginFactory(name string, result map[string]runtime.Object) Plugi func TestNewFrameworkPluginDefaults(t *testing.T) { // In-tree plugins that use args. - pluginsWithArgs := []string{"InterPodAffinity", "NodeLabel", "NodeResourcesFit", "RequestedToCapacityRatio", "PodTopologySpread"} + pluginsWithArgs := []string{"InterPodAffinity", "NodeLabel", "NodeResourcesFit", "NodeResourcesLeastAllocated", "NodeResourcesMostAllocated", "PodTopologySpread", "RequestedToCapacityRatio"} plugins := config.Plugins{ Filter: &config.PluginSet{}, } // Use all plugins in Filter. + // NOTE: This does not mean those plugins implemented `Filter` interfaces. + // `TestPlugin` is created in this test to fake the behavior for test purpose. for _, name := range pluginsWithArgs { plugins.Filter.Enabled = append(plugins.Filter.Enabled, config.Plugin{Name: name}) } @@ -498,6 +500,12 @@ func TestNewFrameworkPluginDefaults(t *testing.T) { }, "NodeLabel": &config.NodeLabelArgs{}, "NodeResourcesFit": &config.NodeResourcesFitArgs{}, + "NodeResourcesLeastAllocated": &config.NodeResourcesLeastAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, + }, + "NodeResourcesMostAllocated": &config.NodeResourcesMostAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, + }, "RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{ Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, }, @@ -519,6 +527,24 @@ func TestNewFrameworkPluginDefaults(t *testing.T) { IgnoredResources: []string{"example.com/foo"}, }, }, + { + Name: "NodeResourcesLeastAllocated", + Args: &config.NodeResourcesLeastAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 4}}, + }, + }, + { + Name: "NodeResourcesMostAllocated", + Args: &config.NodeResourcesMostAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 3}}, + }, + }, + { + Name: "RequestedToCapacityRatio", + Args: &config.RequestedToCapacityRatioArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}}, + }, + }, }, wantCfg: map[string]runtime.Object{ "InterPodAffinity": &config.InterPodAffinityArgs{ @@ -528,10 +554,16 @@ func TestNewFrameworkPluginDefaults(t *testing.T) { "NodeResourcesFit": &config.NodeResourcesFitArgs{ IgnoredResources: []string{"example.com/foo"}, }, - "RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{ - Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}}, + "NodeResourcesLeastAllocated": &config.NodeResourcesLeastAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 4}}, + }, + "NodeResourcesMostAllocated": &config.NodeResourcesMostAllocatedArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 3}}, }, "PodTopologySpread": &config.PodTopologySpreadArgs{}, + "RequestedToCapacityRatio": &config.RequestedToCapacityRatioArgs{ + Resources: []config.ResourceSpec{{Name: "resource", Weight: 2}}, + }, }, }, }