|
@@ -20,6 +20,9 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter.w
|
|
|
|
|
|
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX;
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
+import static org.junit.Assert.assertTrue;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
|
|
@@ -41,7 +44,7 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
|
|
|
FSQueue root = createFSQueues();
|
|
|
converter.convertWeightsForChildQueues(root, config);
|
|
|
|
|
|
- assertEquals("Converted items", 0,
|
|
|
+ assertEquals("Converted items", 1,
|
|
|
config.getPropsWithPrefix(PREFIX).size());
|
|
|
}
|
|
|
|
|
@@ -52,6 +55,8 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
|
|
|
|
|
|
assertEquals("root.a weight", "1.0w",
|
|
|
config.get(PREFIX + "root.a.capacity"));
|
|
|
+ assertEquals("Number of properties", 2,
|
|
|
+ config.getPropsWithPrefix(PREFIX).size());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -60,7 +65,7 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
|
|
|
|
|
|
converter.convertWeightsForChildQueues(root, config);
|
|
|
|
|
|
- assertEquals("Number of properties", 3,
|
|
|
+ assertEquals("Number of properties", 4,
|
|
|
config.getPropsWithPrefix(PREFIX).size());
|
|
|
assertEquals("root.a weight", "1.0w",
|
|
|
config.get(PREFIX + "root.a.capacity"));
|
|
@@ -69,4 +74,26 @@ public class TestWeightToWeightConverter extends WeightConverterTestBase {
|
|
|
assertEquals("root.c weight", "3.0w",
|
|
|
config.get(PREFIX + "root.c.capacity"));
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testAutoCreateV2FlagOnParent() {
|
|
|
+ FSQueue root = createFSQueues(1);
|
|
|
+ converter.convertWeightsForChildQueues(root, config);
|
|
|
+
|
|
|
+ assertTrue("root autocreate v2 enabled",
|
|
|
+ config.getBoolean(PREFIX + "root.auto-queue-creation-v2.enabled",
|
|
|
+ false));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testAutoCreateV2FlagOnParentWithoutChildren() {
|
|
|
+ FSQueue root = createParent(new ArrayList<>());
|
|
|
+ converter.convertWeightsForChildQueues(root, config);
|
|
|
+
|
|
|
+ assertEquals("Number of properties", 1,
|
|
|
+ config.getPropsWithPrefix(PREFIX).size());
|
|
|
+ assertTrue("root autocreate v2 enabled",
|
|
|
+ config.getBoolean(PREFIX + "root.auto-queue-creation-v2.enabled",
|
|
|
+ false));
|
|
|
+ }
|
|
|
}
|