cleanup: move scheduler plugin tests to use PodWrapper

Move scheduler plugin unit tests use testing PodWrapper
where applicable to reduce duplicating pod creation
code and shorten number of lines.

Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
This commit is contained in:
Yibo Zhuang
2022-05-05 10:48:55 -07:00
parent fd08d47d8b
commit bc8f3198d5
18 changed files with 862 additions and 2830 deletions

View File

@@ -80,7 +80,7 @@ func TestMostAllocatedScoringStrategy(t *testing.T) {
// CPU Score: (3000 * MaxNodeScore) / 6000 = 50
// Memory Score: (5000 * MaxNodeScore) / 10000 = 50
// Node2 Score: (50 + 50) / 2 = 50
name: "nothing scheduled, resources requested, differently sized machines",
name: "nothing scheduled, resources requested, differently sized nodes",
requestedPod: st.MakePod().
Req(map[v1.ResourceName]string{"cpu": "1000", "memory": "2000"}).
Req(map[v1.ResourceName]string{"cpu": "2000", "memory": "3000"}).
@@ -94,7 +94,7 @@ func TestMostAllocatedScoringStrategy(t *testing.T) {
resources: defaultResources,
},
{
name: "Resources not set, nothing scheduled, resources requested, differently sized machines",
name: "Resources not set, nothing scheduled, resources requested, differently sized nodes",
requestedPod: st.MakePod().
Req(map[v1.ResourceName]string{"cpu": "1000", "memory": "2000"}).
Req(map[v1.ResourceName]string{"cpu": "2000", "memory": "3000"}).
@@ -185,7 +185,7 @@ func TestMostAllocatedScoringStrategy(t *testing.T) {
// CPU Score: (3000 *100) / 6000 = 50
// Memory Score: (5000 *100) / 10000 = 50
// Node2 Score: (50 * 1 + 50 * 2) / (1 + 2) = 50
name: "nothing scheduled, resources requested, differently sized machines",
name: "nothing scheduled, resources requested, differently sized nodes",
requestedPod: st.MakePod().
Req(map[v1.ResourceName]string{"cpu": "1000", "memory": "2000"}).
Req(map[v1.ResourceName]string{"cpu": "2000", "memory": "3000"}).