YARN-9431. Fix flaky junit test fair.TestAppRunnability after YARN-8967. Contributed by Wilfred Spiegelenburg.
This commit is contained in:
parent
332cab5518
commit
da7f8c244d
@ -293,11 +293,16 @@ private void createApplicationWithAMResourceInternal(
|
||||
Resource amResource, List<ResourceRequest> amReqs) {
|
||||
RMContext rmContext = resourceManager.getRMContext();
|
||||
ApplicationId appId = attId.getApplicationId();
|
||||
// This fakes the placement which is not part of the scheduler anymore
|
||||
ApplicationPlacementContext placementCtx =
|
||||
new ApplicationPlacementContext(queue);
|
||||
// Set the placement in the app and not just in the event in the next call
|
||||
// otherwise with out of order event processing we might remove the app.
|
||||
RMApp rmApp = new RMAppImpl(appId, rmContext, conf, null, user, null,
|
||||
ApplicationSubmissionContext.newInstance(appId, null, queue, null,
|
||||
mock(ContainerLaunchContext.class), false, false, 0, amResource,
|
||||
null),
|
||||
scheduler, null, 0, null, null, amReqs);
|
||||
scheduler, null, 0, null, null, amReqs, placementCtx, -1);
|
||||
rmContext.getRMApps().put(appId, rmApp);
|
||||
}
|
||||
|
||||
|
@ -89,27 +89,27 @@ public void testUserAsDefaultQueue() throws Exception {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotUserAsDefaultQueue() throws Exception {
|
||||
public void testNotUserAsDefaultQueue() {
|
||||
|
||||
// Restarting resource manager since the Conf object is changed changed.
|
||||
resourceManager.stop();
|
||||
// We need a new scheduler since we want to change the conf object. This
|
||||
// requires a new RM to propagate it . Do a proper teardown to not leak
|
||||
tearDown();
|
||||
// Create a new one with the amended config.
|
||||
conf.set(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, "false");
|
||||
resourceManager = new MockRM(conf);
|
||||
resourceManager.start();
|
||||
scheduler = (FairScheduler) resourceManager.getResourceScheduler();
|
||||
|
||||
ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1);
|
||||
createApplicationWithAMResource(appAttemptId, "default", "user2", null);
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1", true)
|
||||
.getNumRunnableApps());
|
||||
createApplicationWithAMResource(appAttemptId, "default", "user1", null);
|
||||
assertEquals(1, scheduler.getQueueManager().getLeafQueue("default", true)
|
||||
.getNumRunnableApps());
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("user2", true)
|
||||
assertEquals(0, scheduler.getQueueManager().getLeafQueue("user1", true)
|
||||
.getNumRunnableApps());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAppAdditionAndRemoval() throws Exception {
|
||||
public void testAppAdditionAndRemoval() {
|
||||
ApplicationAttemptId attemptId = createAppAttemptId(1, 1);
|
||||
ApplicationPlacementContext apc =
|
||||
new ApplicationPlacementContext("user1");
|
||||
|
Loading…
Reference in New Issue
Block a user