goiri commented on code in PR #5745:
URL: https://github.com/apache/hadoop/pull/5745#discussion_r1229981509


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySchedDynamicConfig.java:
##########
@@ -186,131 +185,130 @@ private ClientResponse sendRequest() {
         .get(ClientResponse.class);
   }
 
-  private static class CSConfigGenerator {
-    public static Configuration createPercentageConfig() {
-      Map<String, String> conf = new HashMap<>();
-      conf.put("yarn.scheduler.capacity.root.queues", "default, test1, test2");
-      conf.put("yarn.scheduler.capacity.root.test1.capacity", "50");
-      conf.put("yarn.scheduler.capacity.root.test2.capacity", "50");
-      conf.put("yarn.scheduler.capacity.root.test1.maximum-capacity", "100");
-      conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.test2.state", "RUNNING");
-      return createConfiguration(conf);
-    }
+  private Configuration createPercentageConfig() {
+    Map<String, String> conf = new HashMap<>();
+    conf.put("yarn.scheduler.capacity.root.queues", "default, test1, test2");
+    conf.put("yarn.scheduler.capacity.root.test1.capacity", "50");
+    conf.put("yarn.scheduler.capacity.root.test2.capacity", "50");
+    conf.put("yarn.scheduler.capacity.root.test1.maximum-capacity", "100");
+    conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
+    conf.put("yarn.scheduler.capacity.root.test2.state", "RUNNING");
+    return createConfiguration(conf);
+  }
 
-    public static Configuration createPercentageConfigLegacyAutoCreation() {
-      Map<String, String> conf = new HashMap<>();
-      conf.put("yarn.scheduler.capacity.root.queues", "default, test1, " +
-          "managedtest2");
-      conf.put("yarn.scheduler.capacity.root.test1.capacity", "50");
-      conf.put("yarn.scheduler.capacity.root.managedtest2.capacity", "50");
-      conf.put("yarn.scheduler.capacity.root.test1.maximum-capacity", "100");
-      conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.managedtest2.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.managedtest2." +
-          "auto-create-child-queue.enabled", "true");
-      return createConfiguration(conf);
-    }
+  private Configuration createPercentageConfigLegacyAutoCreation() {
+    Map<String, String> conf = new HashMap<>();
+    conf.put("yarn.scheduler.capacity.root.queues", "default, test1, " +
+        "managedtest2");
+    conf.put("yarn.scheduler.capacity.root.test1.capacity", "50");
+    conf.put("yarn.scheduler.capacity.root.managedtest2.capacity", "50");
+    conf.put("yarn.scheduler.capacity.root.test1.maximum-capacity", "100");
+    conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
+    conf.put("yarn.scheduler.capacity.root.managedtest2.state", "RUNNING");
+    conf.put("yarn.scheduler.capacity.root.managedtest2." +
+        "auto-create-child-queue.enabled", "true");
+    return createConfiguration(conf);
+  }
 
-    public static Configuration createAbsoluteConfigLegacyAutoCreation() {
-      Map<String, String> conf = new HashMap<>();
-      conf.put("yarn.scheduler.capacity.root.queues", "default, managed");
-      conf.put("yarn.scheduler.capacity.root.default.state", "STOPPED");
-      conf.put("yarn.scheduler.capacity.root.managed.capacity", 
"[memory=4096,vcores=4]");
-      
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.capacity",
-          "[memory=2048,vcores=2]");
-      conf.put("yarn.scheduler.capacity.root.managed.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.managed." +
-          "auto-create-child-queue.enabled", "true");
-      
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.acl_submit_applications",
-          "user");
-      
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.acl_administer_queue",
-          "admin");
-      return createConfiguration(conf);
-    }
+  private Configuration createAbsoluteConfigLegacyAutoCreation() {
+    Map<String, String> conf = new HashMap<>();
+    conf.put("yarn.scheduler.capacity.root.queues", "default, managed");
+    conf.put("yarn.scheduler.capacity.root.default.state", "STOPPED");
+    conf.put("yarn.scheduler.capacity.root.default.capacity", 
"[memory=0,vcores=0]");
+    conf.put("yarn.scheduler.capacity.root.managed.capacity", 
"[memory=4096,vcores=4]");
+    
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.capacity",
+        "[memory=2048,vcores=2]");
+    conf.put("yarn.scheduler.capacity.root.managed.state", "RUNNING");
+    conf.put("yarn.scheduler.capacity.root.managed." +
+        "auto-create-child-queue.enabled", "true");
+    
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.acl_submit_applications",
+        "user");
+    
conf.put("yarn.scheduler.capacity.root.managed.leaf-queue-template.acl_administer_queue",
+        "admin");
+    return createConfiguration(conf);
+  }
 
-    public static Configuration createAbsoluteConfig() {
-      Map<String, String> conf = new HashMap<>();
-      conf.put("yarn.scheduler.capacity.root.queues", "default, test1, test2");
-      conf.put("yarn.scheduler.capacity.root.capacity",
-          "[memory=6136,vcores=30]");
-      conf.put("yarn.scheduler.capacity.root.default.capacity",
-          "[memory=3064,vcores=15]");
-      conf.put("yarn.scheduler.capacity.root.test1.capacity",
-          "[memory=2048,vcores=10]");
-      conf.put("yarn.scheduler.capacity.root.test2.capacity",
-          "[memory=1024,vcores=5]");
-      conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.test2.state", "RUNNING");
-      return createConfiguration(conf);
-    }
+  private Configuration createAbsoluteConfig() {
+    Map<String, String> conf = new HashMap<>();
+    conf.put("yarn.scheduler.capacity.root.queues", "default, test1, test2");
+    conf.put("yarn.scheduler.capacity.root.capacity",
+        "[memory=6136,vcores=30]");
+    conf.put("yarn.scheduler.capacity.root.default.capacity",
+        "[memory=3064,vcores=15]");
+    conf.put("yarn.scheduler.capacity.root.test1.capacity",
+        "[memory=2048,vcores=10]");
+    conf.put("yarn.scheduler.capacity.root.test2.capacity",
+        "[memory=1024,vcores=5]");
+    conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
+    conf.put("yarn.scheduler.capacity.root.test2.state", "RUNNING");
+    return createConfiguration(conf);
+  }
 
-    public static Configuration createWeightConfig() {
-      return createWeightConfigInternal(false);
-    }
+  private Configuration createWeightConfig() {
+    return createWeightConfigInternal(false);
+  }
 
-    public static Configuration 
createWeightConfigWithAutoQueueCreationEnabled() {
-      return createWeightConfigInternal(true);
-    }
+  private Configuration createWeightConfigWithAutoQueueCreationEnabled() {
+    return createWeightConfigInternal(true);
+  }
 
-    private static Configuration createWeightConfigInternal(boolean enableAqc) 
{
-      Map<String, String> conf = new HashMap<>();
-      conf.put("yarn.scheduler.capacity.root.queues", "default, test1, test2, 
parent");
-      conf.put("yarn.scheduler.capacity.root.capacity", "1w");
-      conf.put("yarn.scheduler.capacity.root.default.capacity", "10w");
-      conf.put("yarn.scheduler.capacity.root.test1.capacity", "5w");
-      conf.put("yarn.scheduler.capacity.root.test2.capacity", "10w");
-      conf.put("yarn.scheduler.capacity.root.parent.capacity", "20w");
-      conf.put("yarn.scheduler.capacity.root.test1.state", "RUNNING");
-      conf.put("yarn.scheduler.capacity.root.test2.state", "RUNNING");
-
-      if (enableAqc) {
-        final String root = "yarn.scheduler.capacity.root.";
-        conf.put(root +  "auto-queue-creation-v2.enabled", "true");
-
-        conf.put(root + 
"auto-queue-creation-v2.parent-template.acl_submit_applications",
-            "parentUser1");
-        conf.put(root + 
"auto-queue-creation-v2.parent-template.acl_administer_queue",
-            "parentAdmin1");
-
-        conf.put(root + 
"autoParent1.auto-queue-creation-v2.leaf-template.acl_submit_applications",
-            "user1");
-        conf.put(root + 
"autoParent1.auto-queue-creation-v2.leaf-template.acl_administer_queue",
-            "admin1");
-
-        conf.put(root + 
"*.auto-queue-creation-v2.leaf-template.acl_submit_applications",
-            "wildUser1");
-        conf.put(root + 
"*.auto-queue-creation-v2.leaf-template.acl_administer_queue",
-            "wildAdmin1");
-
-
-        conf.put(root + "parent.auto-queue-creation-v2.enabled", "true");
-        conf.put(root + 
"parent.auto-queue-creation-v2.parent-template.acl_submit_applications",
-            "parentUser2");
-        conf.put(root + 
"parent.auto-queue-creation-v2.parent-template.acl_administer_queue",
-            "parentAdmin2");
-
-        conf.put(root + 
"parent.*.auto-queue-creation-v2.leaf-template.acl_submit_applications",
-            "wildUser2");
-        conf.put(root + 
"parent.*.auto-queue-creation-v2.leaf-template.acl_administer_queue",
-            "wildAdmin2");
-      }
-      return createConfiguration(conf);
+  private Configuration createWeightConfigInternal(boolean enableAqc) {

Review Comment:
   Why isn't this static?



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java:
##########
@@ -108,65 +108,42 @@ public TestRMWebServicesCapacitySched() {
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    rm = createMockRM(new CapacitySchedulerConfiguration(
-        new Configuration(false)));
+    rm = createMockRM(setupQueueConfiguration(new 
CapacitySchedulerConfiguration(
+        new Configuration(false))));
     GuiceServletConfig.setInjector(
         Guice.createInjector(new WebServletModule(rm)));
   }
 
-  public static void setupQueueConfiguration(
+  public CapacitySchedulerConfiguration setupQueueConfiguration(

Review Comment:
   This could still be static, no?



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/resources/webapp/scheduler-response-NodeLabelDefaultAPI.xml:
##########
@@ -12,18 +12,18 @@
     <queues>
       <queue xsi:type="capacitySchedulerLeafQueueInfo">
         <queuePath>root.c</queuePath>
-        <capacity>0.0</capacity>
+        <capacity>10.0</capacity>

Review Comment:
   This is all tests, so it should be fine to change this.



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to