chenyulin0719 commented on code in PR #841:
URL: https://github.com/apache/yunikorn-k8shim/pull/841#discussion_r1603745602
##########
pkg/plugin/predicates/predicate_manager_test.go:
##########
@@ -69,8 +69,8 @@ func TestPreemptionPredicatesEmpty(t *testing.T) {
node := framework.NewNodeInfo()
node.SetNode(&v1.Node{})
victims := make([]*v1.Pod, 0)
- index, ok := predicateManager.PreemptionPredicates(pod, node, victims,
0)
- assert.Check(t, !ok, "check should have failed")
+ index := predicateManager.PreemptionPredicates(pod, node, victims, 0)
+ assert.Check(t, index == -1, "check should have failed")
assert.Equal(t, index, -1, "wrong index")
}
Review Comment:
Only 1 assert required.
-> assert.Equal(t, index, -1, "should not find any victim index after
preemption check")
##########
pkg/plugin/predicates/predicate_manager_test.go:
##########
@@ -115,17 +115,17 @@ func TestPreemptionPredicates(t *testing.T) {
node.AddPod(victims[3])
// all but 1 existing pod should need removing
- index, ok := predicateManager.PreemptionPredicates(pod, node, victims,
1)
- assert.Check(t, ok, "check failed")
+ index := predicateManager.PreemptionPredicates(pod, node, victims, 1)
+ assert.Check(t, index != -1, "check failed")
assert.Equal(t, index, 2, "wrong index")
Review Comment:
Ditto
-> assert.Equal(t, index, 2, "wrong index")
##########
pkg/plugin/predicates/predicate_manager_test.go:
##########
@@ -115,17 +115,17 @@ func TestPreemptionPredicates(t *testing.T) {
node.AddPod(victims[3])
// all but 1 existing pod should need removing
- index, ok := predicateManager.PreemptionPredicates(pod, node, victims,
1)
- assert.Check(t, ok, "check failed")
+ index := predicateManager.PreemptionPredicates(pod, node, victims, 1)
+ assert.Check(t, index != -1, "check failed")
assert.Equal(t, index, 2, "wrong index")
// try again, but with too many resources requested
pod = newResourcePod(framework.Resource{MilliCPU: 1500, Memory:
15000000})
pod.Name = "largepod"
pod.UID = "largepod"
- index, ok = predicateManager.PreemptionPredicates(pod, node, victims, 1)
- assert.Check(t, !ok, "check should have failed")
+ index = predicateManager.PreemptionPredicates(pod, node, victims, 1)
+ assert.Check(t, index == -1, "check should have failed")
assert.Equal(t, index, -1, "wrong index")
Review Comment:
Ditto.
-> assert.Equal(t, index, -1, "should not find any victim index after
preemption check")
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]