brandboat commented on code in PR #860:
URL: https://github.com/apache/yunikorn-core/pull/860#discussion_r1581760538


##########
pkg/common/configs/configvalidator_test.go:
##########
@@ -1910,3 +1910,80 @@ func TestCheckLimitsStructure(t *testing.T) {
        assert.Equal(t, len(partitionConfig.Queues[0].Limits), 0)
        assert.Equal(t, len(partitionConfig.Limits), 0)
 }
+

Review Comment:
   Please remove the redundant link. 



##########
pkg/common/configs/configvalidator_test.go:
##########
@@ -1910,3 +1910,80 @@ func TestCheckLimitsStructure(t *testing.T) {
        assert.Equal(t, len(partitionConfig.Queues[0].Limits), 0)
        assert.Equal(t, len(partitionConfig.Limits), 0)
 }
+
+
+func TestCheckQueuesStructure(t *testing.T) {
+    testCases := []struct {
+        name          string
+        partition     *PartitionConfig
+        errorExpected bool
+    }{
+        {
+            name: "No Queues Configured",
+            partition: &PartitionConfig{Queues: nil},
+            errorExpected: true,
+        },
+        {
+            name: "Single Root Queue",
+            partition: &PartitionConfig{
+                Queues: []QueueConfig{
+                    {Name: "root", Parent: true},
+                },
+            },
+            errorExpected: false,
+        },
+        {
+            name: "Single Non-Root Queue",
+            partition: &PartitionConfig{
+                Queues: []QueueConfig{
+                    {Name: "non-root"},
+                },
+            },
+            errorExpected: false,
+        },
+        {
+            name: "Multiple Top-Level Queues",
+            partition: &PartitionConfig{
+                Queues: []QueueConfig{
+                    {Name: "queue1"},
+                    {Name: "queue2"},
+                },
+            },
+            errorExpected: false,
+        },
+               {
+            name: "Root Queue With Guaranteed Resources",
+            partition: &PartitionConfig{
+                Queues: []QueueConfig{
+                    {
+                                               Name: "root", 
+                                               Parent: true, 
+                                               Resources: 
Resources{Guaranteed: map[string]string{"memory": "1000Mi"}}},
+                },
+            },
+            errorExpected: true,
+        },
+        {
+            name: "Root Queue With Max Resources",
+            partition: &PartitionConfig{
+                Queues: []QueueConfig{
+                    {
+                                               Name: "root", 
+                                               Parent: true, 
+                                               Resources: Resources{Max: 
map[string]string{"memory": "2000Mi"}}},
+                },
+            },
+            errorExpected: true,
+        },
+    }
+       for _, tc := range testCases {
+               t.Run(tc.name, func(t *testing.T) {
+                       err := checkQueuesStructure(tc.partition)
+                       if tc.errorExpected {
+                               assert.Assert(t, err != nil, "An error is 
expected")
+                       } else {
+                               assert.NilError(t, err, "No error is expected")
+                       }
+               })
+       }
+}

Review Comment:
   nit: Could you add one blank line here ?



##########
pkg/common/configs/configvalidator_test.go:
##########
@@ -1910,3 +1910,80 @@ func TestCheckLimitsStructure(t *testing.T) {
        assert.Equal(t, len(partitionConfig.Queues[0].Limits), 0)
        assert.Equal(t, len(partitionConfig.Limits), 0)
 }
+
+
+func TestCheckQueuesStructure(t *testing.T) {

Review Comment:
   We can also check the content of the error message. And if possible, it 
would be great to verify whether rootQueue has been correctly added to the 
PartitionConfig as well.



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