baconYao commented on code in PR #878:
URL: https://github.com/apache/yunikorn-k8shim/pull/878#discussion_r1682983379
##########
test/e2e/framework/helpers/yunikorn/rest_api_utils.go:
##########
@@ -419,30 +419,31 @@ func GetFailedHealthChecks() (string, error) {
return failCheck, nil
}
-func (c *RClient) GetQueue(partition string, queueName string)
(*dao.PartitionQueueDAOInfo, error) {
- queues, err := c.GetQueues(partition)
+func (c *RClient) GetQueue(partition string, queueName string, withChildren
bool) (*dao.PartitionQueueDAOInfo, error) {
+ req, err := c.newRequest("GET", fmt.Sprintf(configmanager.QueuePath,
partition, queueName), nil)
if err != nil {
return nil, err
}
- if queueName == "root" {
- return queues, nil
+ if withChildren {
+ q := req.URL.Query()
+ q.Add("subtree", "true")
+ req.URL.RawQuery = q.Encode()
}
- var allSubQueues = queues.Children
- for _, subQ := range allSubQueues {
- if subQ.QueueName == queueName {
- return &subQ, nil
- }
+ var queue *dao.PartitionQueueDAOInfo
+ _, err = c.do(req, &queue)
+ if queue == nil {
+ return nil, fmt.Errorf("QueueInfo not found: %s", queueName)
}
- return nil, fmt.Errorf("QueueInfo not found: %s", queueName)
+ return queue, err
Review Comment:
```suggestion
return queue, nil
```
Should we return `nil` if no error be observed?
--
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]