|
@@ -1661,6 +1661,41 @@ public class TestFairScheduler extends FairSchedulerTestBase {
|
|
|
assertEquals("Incorrect number of containers allocated", 8, app
|
|
|
.getLiveContainers().size());
|
|
|
}
|
|
|
+
|
|
|
+ @Test(timeout = 3000)
|
|
|
+ public void testMaxAssignWithZeroMemoryContainers() throws Exception {
|
|
|
+ conf.setBoolean(FairSchedulerConfiguration.ASSIGN_MULTIPLE, true);
|
|
|
+ conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 0);
|
|
|
+
|
|
|
+ scheduler.init(conf);
|
|
|
+ scheduler.start();
|
|
|
+ scheduler.reinitialize(conf, resourceManager.getRMContext());
|
|
|
+
|
|
|
+ RMNode node =
|
|
|
+ MockNodes.newNodeInfo(1, Resources.createResource(16384, 16), 0,
|
|
|
+ "127.0.0.1");
|
|
|
+ NodeAddedSchedulerEvent nodeEvent = new NodeAddedSchedulerEvent(node);
|
|
|
+ NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node);
|
|
|
+ scheduler.handle(nodeEvent);
|
|
|
+
|
|
|
+ ApplicationAttemptId attId =
|
|
|
+ createSchedulingRequest(0, 1, "root.default", "user", 8);
|
|
|
+ FSSchedulerApp app = scheduler.getSchedulerApp(attId);
|
|
|
+
|
|
|
+ // set maxAssign to 2: only 2 containers should be allocated
|
|
|
+ scheduler.maxAssign = 2;
|
|
|
+ scheduler.update();
|
|
|
+ scheduler.handle(updateEvent);
|
|
|
+ assertEquals("Incorrect number of containers allocated", 2, app
|
|
|
+ .getLiveContainers().size());
|
|
|
+
|
|
|
+ // set maxAssign to -1: all remaining containers should be allocated
|
|
|
+ scheduler.maxAssign = -1;
|
|
|
+ scheduler.update();
|
|
|
+ scheduler.handle(updateEvent);
|
|
|
+ assertEquals("Incorrect number of containers allocated", 8, app
|
|
|
+ .getLiveContainers().size());
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Test to verify the behavior of
|