Update scheduler framework plugins to align with the latest changes to the framework design

This commit is contained in:
Bobby (Babak) Salamat
2019-03-20 17:07:25 -07:00
parent b3ad4cd6b9
commit 404dc1ed79
26 changed files with 631 additions and 701 deletions

View File

@@ -1078,7 +1078,7 @@ func TestNodeOperators(t *testing.T) {
// Case 2: dump cached nodes successfully.
cachedNodes := NewNodeInfoSnapshot()
cache.UpdateNodeInfoSnapshot(&cachedNodes)
cache.UpdateNodeInfoSnapshot(cachedNodes)
newNode, found := cachedNodes.NodeInfoMap[node.Name]
if !found || len(cachedNodes.NodeInfoMap) != 1 {
t.Errorf("failed to dump cached nodes:\n got: %v \nexpected: %v", cachedNodes, cache.nodes)
@@ -1180,7 +1180,7 @@ func TestSchedulerCache_UpdateNodeInfoSnapshot(t *testing.T) {
}
var cache *schedulerCache
var snapshot NodeInfoSnapshot
var snapshot *NodeInfoSnapshot
type operation = func()
addNode := func(i int) operation {
@@ -1215,8 +1215,8 @@ func TestSchedulerCache_UpdateNodeInfoSnapshot(t *testing.T) {
}
updateSnapshot := func() operation {
return func() {
cache.UpdateNodeInfoSnapshot(&snapshot)
if err := compareCacheWithNodeInfoSnapshot(cache, &snapshot); err != nil {
cache.UpdateNodeInfoSnapshot(snapshot)
if err := compareCacheWithNodeInfoSnapshot(cache, snapshot); err != nil {
t.Error(err)
}
}
@@ -1356,8 +1356,8 @@ func TestSchedulerCache_UpdateNodeInfoSnapshot(t *testing.T) {
}
// Always update the snapshot at the end of operations and compare it.
cache.UpdateNodeInfoSnapshot(&snapshot)
if err := compareCacheWithNodeInfoSnapshot(cache, &snapshot); err != nil {
cache.UpdateNodeInfoSnapshot(snapshot)
if err := compareCacheWithNodeInfoSnapshot(cache, snapshot); err != nil {
t.Error(err)
}
})
@@ -1391,7 +1391,7 @@ func BenchmarkUpdate1kNodes30kPods(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
cachedNodes := NewNodeInfoSnapshot()
cache.UpdateNodeInfoSnapshot(&cachedNodes)
cache.UpdateNodeInfoSnapshot(cachedNodes)
}
}