chenyulin0719 commented on code in PR #985:
URL: https://github.com/apache/yunikorn-core/pull/985#discussion_r1802534557


##########
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:
   We can remove tje `iterator` because `nodes` can be used to generate an 
`iterator`.



##########
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:
   I'm not in favor of using 7 paramters to represent the queue configuration, 
especially when there is only one difference in `childQ2GuarRes` in 
`TestTryPreemption_NodeWithCapacityLesserThanAsk`



-- 
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]

Reply via email to