SophieTech88 commented on code in PR #985:
URL: https://github.com/apache/yunikorn-core/pull/985#discussion_r1803667265
##########
pkg/scheduler/objects/preemption_test.go:
##########
@@ -204,6 +204,233 @@ func
TestCheckPreemptionQueueGuaranteesWithNoGuaranteedResources(t *testing.T) {
}
}
+
+// setupQueues sets up the queue hierarchy for the test cases, passing custom
maxRes and guarRes.
+func setupQueues(testCase string, rootMaxRex, parentMaxRes, parentGuarRes,
childQ1MaxRes, childQ1GuarRes, childQ2MaxRes, childQ2GuarRes map[string]string)
(rootQ, parentQ, childQ1, childQ2 *Queue, err error) {
+ // Create root queue
+ rootQ, err = createRootQueue(rootMaxRex)
+ if err != nil {
+ return nil, nil, nil, nil, err
+ }
+
+ // Create parent queue with custom maxRes and guarRes
+ parentQ, err = createManagedQueueGuaranteed(rootQ, "parent", true,
parentMaxRes, parentGuarRes)
+ if err != nil {
+ return nil, nil, nil, nil, err
+ }
+
+ // Create child queues with custom maxRes and guarRes for childQ1 and
childQ2
+ childQ1, err = createManagedQueueGuaranteed(parentQ, "child1", false,
childQ1MaxRes, childQ1GuarRes)
+ if err != nil {
+ return nil, nil, nil, nil, err
+ }
+
+ childQ2, err = createManagedQueueGuaranteed(parentQ, "child2", false,
childQ2MaxRes, childQ2GuarRes)
+ if err != nil {
+ return nil, nil, nil, nil, err
+ }
+
+ return rootQ, parentQ, childQ1, childQ2, nil
+}
+
+
+func TestTryPreemptionMerge(t *testing.T) {
+ var tests = []struct {
+ testCase string
+ nodes []*Node
+ iterator func() NodeIterator
Review Comment:
Yeah. And I restructure the test function again , and keep the `node`
`iterator` in the body, not as parameters. I hope it will be better. Thank you!
--
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]