SophieTech88 commented on code in PR #985:
URL: https://github.com/apache/yunikorn-core/pull/985#discussion_r1803666414
##########
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
+ rootMaxRes map[string]string
+ parentMaxRes map[string]string
+ parentGuarRes map[string]string
+ childQ1MaxRes map[string]string
+ childQ1GuarRes map[string]string
+ childQ2MaxRes map[string]string
+ childQ2GuarRes map[string]string
Review Comment:
Thank you so much. I agree that there are too many parameters here. I jus
reduced to 2 parameters: rootMaxRes and childQ2GuarRes.
--
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]