Skip to content

Commit

Permalink
Scheduler: refactor: move scheduling tests to internaltypes (#4113)
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Smith <robertdavidsmith@yahoo.com>
  • Loading branch information
robertdavidsmith authored Jan 3, 2025
1 parent df5401c commit e1e91a9
Show file tree
Hide file tree
Showing 11 changed files with 388 additions and 587 deletions.
1 change: 1 addition & 0 deletions internal/scheduler/internaltypes/resource_list_map_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func NewAllocatableByPriorityAndResourceType(priorities []int32, rl ResourceList
for _, priority := range priorities {
result[priority] = rl
}
result[EvictedPriority] = rl
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ func TestNewAllocatableByPriorityAndResourceType(t *testing.T) {
rl := testResourceList(factory, "2", "2Ki")

result := NewAllocatableByPriorityAndResourceType([]int32{1, 2}, rl)
assert.Equal(t, 2, len(result))
assert.Equal(t, 3, len(result))
assert.Equal(t, int64(2000), result[1].GetByNameZeroIfMissing("cpu"))
assert.Equal(t, int64(2000), result[2].GetByNameZeroIfMissing("cpu"))
assert.Equal(t, int64(2000), result[EvictedPriority].GetByNameZeroIfMissing("cpu"))
}

func TestMarkAllocated(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions internal/scheduler/nodedb/nodedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ func BenchmarkScheduleMany100CpuNodes1CpuUnused(b *testing.B) {
b,
testfixtures.ItWithUsedResourcesNodes(
0,
cpu("31"),
testfixtures.Cpu("31"),
testfixtures.ItN32CpuNodes(100, testfixtures.TestPriorities),
),
testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 100),
Expand All @@ -845,7 +845,7 @@ func BenchmarkScheduleMany1000CpuNodes1CpuUnused(b *testing.B) {
b,
testfixtures.ItWithUsedResourcesNodes(
0,
cpu("31"),
testfixtures.Cpu("31"),
testfixtures.ItN32CpuNodes(1000, testfixtures.TestPriorities),
),
testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 1000),
Expand All @@ -857,7 +857,7 @@ func BenchmarkScheduleMany10000CpuNodes1CpuUnused(b *testing.B) {
b,
testfixtures.ItWithUsedResourcesNodes(
0,
cpu("31"),
testfixtures.Cpu("31"),
testfixtures.ItN32CpuNodes(10000, testfixtures.TestPriorities),
),
testfixtures.N1Cpu4GiJobs("A", testfixtures.PriorityClass0, 10000),
Expand Down
Loading

0 comments on commit e1e91a9

Please sign in to comment.