Move scheduling Heap in to scheduler.core.utils

The Heap data structure is useful for our backoff system in addition to
scheduling queue. Move it to somewhere it can be consumed by both
systems and properly export needed names. Also adding unit tests
from client-go/tools/cache/heap.go.
This commit is contained in:
Gregory Haynes
2017-12-09 23:09:48 +00:00
parent 3b53ea5ea4
commit c821f2ed2f
5 changed files with 503 additions and 203 deletions

View File

@@ -199,7 +199,7 @@ func TestPriorityQueue_Update(t *testing.T) {
}
// Update highPriorityPod and add a nominatedNodeName to it.
q.Update(&highPriorityPod, &highPriNominatedPod)
if q.activeQ.data.Len() != 1 {
if q.activeQ.Len() != 1 {
t.Error("Expected only one item in activeQ.")
}
if len(q.nominatedPods) != 1 {
@@ -250,7 +250,7 @@ func TestPriorityQueue_MoveAllToActiveQueue(t *testing.T) {
q.unschedulableQ.addOrUpdate(&unschedulablePod)
q.unschedulableQ.addOrUpdate(&highPriorityPod)
q.MoveAllToActiveQueue()
if q.activeQ.data.Len() != 3 {
if q.activeQ.Len() != 3 {
t.Error("Expected all items to be in activeQ.")
}
}