rrajesh-cloudera commented on code in PR #915:
URL: https://github.com/apache/yunikorn-k8shim/pull/915#discussion_r1761406258


##########
test/e2e/user_group_limit/user_group_limit_test.go:
##########
@@ -911,6 +925,200 @@ var _ = ginkgo.Describe("UserGroupLimit", func() {
                checkUsageWildcardGroups(groupTestType, group2, sandboxQueue1, 
[]*v1.Pod{group2Sandbox1Pod1, group2Sandbox1Pod2, group2Sandbox1Pod3})
        })
 
+       ginkgo.It("Verify User info for the non kube admin user", func() {
+               var clientset *kubernetes.Clientset
+               var namespace = "default"
+               var serviceAccountName = "test-user-sa"
+               var podName = "test-pod"
+               var secretName = "test-user-sa-token" // #nosec G101
+               clientset = kClient.GetClient()
+               ginkgo.By("Update config")
+               // The wait wrapper still can't fully guarantee that the config 
in AdmissionController has been updated.
+               admissionCustomConfig = map[string]string{
+                       "log.core.scheduler.ugm.level":   "debug",
+                       amconf.AMAccessControlBypassAuth: constants.False,
+               }
+               
yunikorn.WaitForAdmissionControllerRefreshConfAfterAction(func() {
+                       
yunikorn.UpdateCustomConfigMapWrapperWithMap(oldConfigMap, "", 
admissionCustomConfig, func(sc *configs.SchedulerConfig) error {
+                               // remove placement rules so we can control 
queue
+                               sc.Partitions[0].PlacementRules = nil
+
+                               err := common.AddQueue(sc, 
constants.DefaultPartition, constants.RootQueue, configs.QueueConfig{
+                                       Name: "default",
+                                       Limits: []configs.Limit{
+                                               {
+                                                       Limit:           "user 
entry",
+                                                       Users:           
[]string{user1},
+                                                       MaxApplications: 1,
+                                                       MaxResources: 
map[string]string{
+                                                               
siCommon.Memory: fmt.Sprintf("%dM", mediumMem),
+                                                       },
+                                               },
+                                               {
+                                                       Limit:           "user2 
entry",
+                                                       Users:           
[]string{user2},
+                                                       MaxApplications: 2,
+                                                       MaxResources: 
map[string]string{
+                                                               
siCommon.Memory: fmt.Sprintf("%dM", largeMem),
+                                                       },
+                                               },
+                                       }})
+                               if err != nil {
+                                       return err
+                               }
+                               return common.AddQueue(sc, 
constants.DefaultPartition, constants.RootQueue, configs.QueueConfig{Name: 
"sandbox2"})
+                       })
+               })
+               // Backup the existing kubeconfig
+               oldKubeconfigPath := filepath.Join(os.Getenv("HOME"), ".kube", 
"config")
+               if _, err := os.Stat(oldKubeconfigPath); !os.IsNotExist(err) {
+                       oldKubeconfigContent, err = 
os.ReadFile(oldKubeconfigPath)
+                       gomega.Ω(err).NotTo(HaveOccurred())
+               }

Review Comment:
   Hi, @ryankert01  Thanks for Pointing out. I forgot to add the steps to 
restore oldkubeconfig after the test. I have updated the code for restoring 
oldkubeconfig.
   You can refer to Line no : 1108-1112 for more details. 



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