mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
scheduler: Expand testcases to cover more plugin defaults
Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
ebcae8ff2c
commit
c74a5d4fe2
@ -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}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user