Skip to content

Commit

Permalink
rebasing, adding functions and directly using literals
Browse files Browse the repository at this point in the history
  • Loading branch information
0yukali0 committed Sep 9, 2023
1 parent c50d301 commit 4e07a6c
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 190 deletions.
49 changes: 9 additions & 40 deletions test/e2e/framework/helpers/yunikorn/rest_api_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,20 +410,8 @@ func (c *RClient) GetUserUsage(partition string, userName string) (*dao.UserReso
return userUsage, err
}



func (c *RClient) GetGroupUsage(partition string, groupName string) (*dao.GroupResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.GroupUsagePath, partition, groupName), nil)
if err != nil {
return nil, err
}
var groupUsage *dao.GroupResourceUsageDAOInfo
_, err = c.do(req, &groupUsage)
return groupUsage, err
}

func (c *RClient) GetUserssage(partition string) ([]*dao.UserResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.UsersTrackerPath, partition), nil)
func (c *RClient) GetUsersUsage(partition string) ([]*dao.UserResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.UsersUsagePath, partition), nil)
if err != nil {
return nil, err
}
Expand All @@ -432,45 +420,26 @@ func (c *RClient) GetUserssage(partition string) ([]*dao.UserResourceUsageDAOInf
return usersUsage, err
}

<<<<<<< HEAD
func (c *RClient) GetGroupsUsage(partition string) ([]*dao.GroupResourceUsageDAOInfo, error) {
=======
func (c *RClient) GetUserResourceUsage(partition string, user string) (*dao.UserResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.UserTrackerPath, partition, user), nil)
func (c *RClient) GetGroupUsage(partition string, groupName string) (*dao.GroupResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.GroupUsagePath, partition, groupName), nil)
if err != nil {
return nil, err
}
var userUsage *dao.UserResourceUsageDAOInfo
_, err = c.do(req, userUsage)
return userUsage, err
var groupUsage *dao.GroupResourceUsageDAOInfo
_, err = c.do(req, &groupUsage)
return groupUsage, err
}

func (c *RClient) GetGroupsResourceUsage(partition string) ([]*dao.GroupResourceUsageDAOInfo, error) {
>>>>>>> 97e86d38 ([YUNIKORN-1901] A basic example for the user tracing and the group tracing)
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.GroupsTrackerPath, partition), nil)
func (c *RClient) GetGroupsUsage(partition string) ([]*dao.GroupResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.GroupsUsagePath, partition), nil)
if err != nil {
return nil, err
}
<<<<<<< HEAD
var groupsUsage []*dao.GroupResourceUsageDAOInfo
_, err = c.do(req, groupsUsage)
return groupsUsage, err
=======
var gourpsUsage []*dao.GroupResourceUsageDAOInfo
_, err = c.do(req, gourpsUsage)
return gourpsUsage, err
}

func (c *RClient) GetGroupResourceUsage(partition string, user string) (*dao.GroupResourceUsageDAOInfo, error) {
req, err := c.newRequest("GET", fmt.Sprintf(configmanager.GroupTrackerPath, partition, user), nil)
if err != nil {
return nil, err
}
var groupUsage *dao.GroupResourceUsageDAOInfo
_, err = c.do(req, groupUsage)
return groupUsage, err
>>>>>>> 97e86d38 ([YUNIKORN-1901] A basic example for the user tracing and the group tracing)
}

func GetUserUsageFromUsersUsage(users []*dao.UserResourceUsageDAOInfo, target string) (*dao.UserResourceUsageDAOInfo, error) {
for _, user := range users {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func init() {
var oldConfigMap = new(v1.ConfigMap)
var annotation = "ann-" + common.RandSeq(10)
var kClient = k8s.KubeCtl{} //nolint
var RestClient = yunikorn.RClient{}

var _ = BeforeSuite(func() {
Ω(kClient.SetClient()).To(BeNil())
Expand Down
Loading

0 comments on commit 4e07a6c

Please sign in to comment.