SophieTech88 commented on code in PR #863:
URL: https://github.com/apache/yunikorn-core/pull/863#discussion_r1588304754
##########
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",
+ },
+ {
+ name: "Duplicate Child Queue Names at level 1",
+ queue: &QueueConfig{
+ Name: "root",
+ AdminACL: "admin",
+ SubmitACL: "submit",
+ Queues: []QueueConfig{
+ {
+ Name: "subqueue",
+ AdminACL: "admin",
+ SubmitACL: "submit",
+ Queues: []QueueConfig{
+ {Name:
"duplicateQueue"},
+ {Name:
"duplicateQueue"},
+ },
+ },
+ },
+ },
+ level: 0,
+ errorExpected: true,
+ expectedErrorMsg: "duplicate child name found with name
duplicateQueue, level 1",
+ },
+ {
+ name: "Check Limits Error With Duplicated User Name",
+ queue: &QueueConfig{
+ Name: "root",
+ AdminACL: "admin",
+ SubmitACL: "submit",
+ Queues: []QueueConfig{
+ {
+ Name: "subqueue",
+ },
+ },
+ Limits: []Limit{
+ {
+ Limit: "user-limit",
+ Users: []string{"user1",
"user2", "user1"},
+ },
+ },
+ },
+ level: 0,
+ errorExpected: true,
+ expectedErrorMsg: "duplicated user name user1 , already
existed",
Review Comment:
for checkLimit function, it checks the user name is duplicate or not.
The original code is
[here](https://github.com/apache/yunikorn-core/blob/master/pkg/common/configs/configvalidator.go#L491):
```
if existedUserName[name] {
return fmt.Errorf("duplicated user name %s , already existed", name)
}
```
And I just want to trigger the error of `checkLimits` for `chckQueues`
function.
So the expectedErrorMsg is `duplicated user name user1 , already existed`.
The whitespaces exist . So I need to match the expectedErrorMsg to the return
error.
Do I need to change the both error message?
--
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]