SophieTech88 commented on code in PR #863:
URL: https://github.com/apache/yunikorn-core/pull/863#discussion_r1588309025


##########
pkg/common/configs/configvalidator_test.go:
##########
@@ -2012,3 +2012,227 @@ func TestCheckQueuesStructure(t *testing.T) {
                })
        }
 }
+
+func TestCheckQueues(t *testing.T) {
+       testCases := []struct {
+               name             string
+               queue            *QueueConfig
+               level            int
+               errorExpected    bool
+               expectedErrorMsg string
+               validateFunc     func(t *testing.T, queue *QueueConfig)
+       }{
+               {
+                       name: "Invalid ACL Format for AdminACL",
+                       queue: &QueueConfig{
+                               Name:      "validQueue",
+                               AdminACL:  "admin group extra",
+                               SubmitACL: "submit",
+                               Queues:    []QueueConfig{{Name: 
"validSubQueue"}},
+                       },
+                       level:            0,
+                       errorExpected:    true,
+                       expectedErrorMsg: "multiple spaces found in ACL: 'admin 
group extra'",
+               },
+               {
+                       name: "Invalid ACL Format for SubmitACL",
+                       queue: &QueueConfig{
+                               Name:      "validQueue",
+                               AdminACL:  "admin",
+                               SubmitACL: "submit group extra",
+                               Queues:    []QueueConfig{{Name: 
"validSubQueue"}},
+                       },
+                       level:            0,
+                       errorExpected:    true,
+                       expectedErrorMsg: "multiple spaces found in ACL: 
'submit group extra'",
+               },
+               {
+                       name: "Duplicate Child Queue Names",
+                       queue: &QueueConfig{
+                               Name:      "root",
+                               AdminACL:  "admin",
+                               SubmitACL: "submit",
+                               Queues: []QueueConfig{
+                                       {Name: "duplicateQueue"},
+                                       {Name: "duplicateQueue"},
+                               },
+                       },
+                       level:            0,
+                       errorExpected:    true,
+                       expectedErrorMsg: "duplicate child name found with name 
duplicateQueue, level 0",

Review Comment:
   Something similar here, the expectedErrorMsg need to match the return error 
when it call the function `checkQueues`, the error message to duplicate name is 
[here](https://github.com/apache/yunikorn-core/blob/master/pkg/common/configs/configvalidator.go#L660):
   ```
   if queueMap[strings.ToLower(child.Name)] {
       return fmt.Errorf("duplicate child name found with name %s, level %d", 
child.Name, level)
   }
   ```
   Do I need to add single quote `'` to the error messages for both?



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