From 04c70e54e53b9a3a4640f849a8ff795bae4cf9ea Mon Sep 17 00:00:00 2001 From: 0yukali0 Date: Sun, 10 Sep 2023 07:59:50 +0800 Subject: [PATCH] fix lint problem --- .../helpers/yunikorn/rest_api_utils.go | 1 - .../user_quota_tracing_test.go | 40 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/test/e2e/framework/helpers/yunikorn/rest_api_utils.go b/test/e2e/framework/helpers/yunikorn/rest_api_utils.go index 8eb85f8f2..0c7fea0ea 100644 --- a/test/e2e/framework/helpers/yunikorn/rest_api_utils.go +++ b/test/e2e/framework/helpers/yunikorn/rest_api_utils.go @@ -440,7 +440,6 @@ func (c *RClient) GetGroupsUsage(partition string) ([]*dao.GroupResourceUsageDAO return groupsUsage, err } - func GetUserUsageFromUsersUsage(users []*dao.UserResourceUsageDAOInfo, target string) (*dao.UserResourceUsageDAOInfo, error) { for _, user := range users { if user.UserName == target { diff --git a/test/e2e/user_quota_tracing/user_quota_tracing_test.go b/test/e2e/user_quota_tracing/user_quota_tracing_test.go index 82ea52d26..b786b7bcc 100644 --- a/test/e2e/user_quota_tracing/user_quota_tracing_test.go +++ b/test/e2e/user_quota_tracing/user_quota_tracing_test.go @@ -94,7 +94,7 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { "group1": { []string{"user1-app-01", "user3-app-02"}, map[string]ExpectedQueue{ - "root": {[]string{"user1-app-01", "user3-app-02"}, twoPods}, + "root": {[]string{"user1-app-01", "user3-app-02"}, twoPods}, "root.group1_resources": {[]string{"user1-app-01", "user3-app-02"}, twoPods}, "root.group2_resources": {[]string{}, zeroPod}, }, @@ -102,7 +102,7 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { "group2": { []string{"user2-app-01", "user3-app-01"}, map[string]ExpectedQueue{ - "root": {[]string{"user2-app-01", "user3-app-01"}, twoPods}, + "root": {[]string{"user2-app-01", "user3-app-01"}, twoPods}, "root.group1_resources": {[]string{}, zeroPod}, "root.group2_resources": {[]string{"user2-app-01", "user3-app-01"}, twoPods}, }, @@ -118,7 +118,7 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { "user1": { map[string]string{"user1-app-01": "group1"}, map[string]ExpectedQueue{ - "root": {[]string{"user1-app-01"}, onePod}, + "root": {[]string{"user1-app-01"}, onePod}, "root.group1_resources": {[]string{"user1-app-01"}, onePod}, "root.group2_resources": {[]string{}, zeroPod}, }, @@ -126,7 +126,7 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { "user2": { map[string]string{"user2-app-01": "group2"}, map[string]ExpectedQueue{ - "root": {[]string{"user2-app-01"}, onePod}, + "root": {[]string{"user2-app-01"}, onePod}, "root.group1_resources": {[]string{"user2-app-01"}, onePod}, "root.group2_resources": {[]string{}, zeroPod}, }, @@ -134,7 +134,7 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { "user3": { map[string]string{"user3-app-01": "group2", "user3-app-02": "group1"}, map[string]ExpectedQueue{ - "root": {[]string{"user3-app-01", "user3-app-02"}, twoPods}, + "root": {[]string{"user3-app-01", "user3-app-02"}, twoPods}, "root.group1_resources": {[]string{"user3-app-02"}, onePod}, "root.group2_resources": {[]string{"user3-app-01"}, onePod}, }, @@ -159,20 +159,20 @@ var _ = Describe("QuotaTracking: Two leaf queues for two groups", func() { func deploySleepPod(appID, queue, userName string, groupsName []string, ns string) { By(fmt.Sprintf("Deploy the sleep app %s to the %s namespace", appID, ns)) - sleepObj, podErr := k8s.InitSleepPod(k8s.SleepPodConfig{ - AppID: appID, - NS: ns, - Labels: map[string]string{"queue": queue}, - }) - sleepObj.ObjectMeta.Annotations["yunikorn.apache.org/user.info"] = fmt.Sprintf("{username:%s, groups:{%s}}", userName, groupsName) - Ω(podErr).NotTo(HaveOccurred()) - sleepRespPod, podErr := kClient.CreatePod(sleepObj, ns) - Ω(podErr).NotTo(HaveOccurred()) + sleepObj, podErr := k8s.InitSleepPod(k8s.SleepPodConfig{ + AppID: appID, + NS: ns, + Labels: map[string]string{"queue": queue}, + }) + sleepObj.ObjectMeta.Annotations["yunikorn.apache.org/user.info"] = fmt.Sprintf("{username:%s, groups:{%s}}", userName, groupsName) + Ω(podErr).NotTo(HaveOccurred()) + sleepRespPod, podErr := kClient.CreatePod(sleepObj, ns) + Ω(podErr).NotTo(HaveOccurred()) - // Wait for pod to move to running state - podErr = kClient.WaitForPodBySelectorRunning(ns, - fmt.Sprintf("app=%s", sleepRespPod.ObjectMeta.Labels["app"]), WAIT_INTERVAL) - Ω(podErr).NotTo(HaveOccurred()) + // Wait for pod to move to running state + podErr = kClient.WaitForPodBySelectorRunning(ns, + fmt.Sprintf("app=%s", sleepRespPod.ObjectMeta.Labels["app"]), WAIT_INTERVAL) + Ω(podErr).NotTo(HaveOccurred()) } type ExpectedQueue struct { @@ -251,7 +251,7 @@ func checkUserUsage(FromREST bool, usersUsage []*dao.UserResourceUsageDAOInfo, e type ExpectedUsersQuota struct { NumberOfUsers int - Users map[string]ExpectedUserQuota + Users map[string]ExpectedUserQuota } func checkUsersUsage(expectedUsersUsage ExpectedUsersQuota) { @@ -260,4 +260,4 @@ func checkUsersUsage(expectedUsersUsage ExpectedUsersQuota) { Ω(err).NotTo(HaveOccurred()) Ω(len(usersUsage)).To(Equal(expectedUsersUsage.NumberOfUsers), "Total number of users is not correct") checkUserUsage(false, usersUsage, expectedUsersUsage.Users) -} \ No newline at end of file +}