Skip to content

Commit

Permalink
YARN-11764. Fix CheckStyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
fanshilun committed Feb 4, 2025
1 parent f9307bb commit 20785c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,44 +178,38 @@ public void testGetSchedulerConf() throws Exception {
ByteArrayOutputStream sysOutStream = new ByteArrayOutputStream();
PrintStream sysOut = new PrintStream(sysOutStream);
System.setOut(sysOut);
try {
int exitCode = cli.getSchedulerConf("", target());
assertEquals("SchedConfCLI failed to run", 0, exitCode);
assertTrue("Failed to get scheduler configuration",
sysOutStream.toString().contains("testqueue"));
} finally {
cleanUp();
}

int exitCode = cli.getSchedulerConf("", target());
assertEquals("SchedConfCLI failed to run", 0, exitCode);
assertTrue("Failed to get scheduler configuration",
sysOutStream.toString().contains("testqueue"));
}

@Test(timeout = 10000)
public void testFormatSchedulerConf() throws Exception {
try {
ResourceScheduler scheduler = rm.getResourceScheduler();
MutableConfigurationProvider provider =
((MutableConfScheduler) scheduler).getMutableConfProvider();

SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo();
HashMap<String, String> globalUpdates = new HashMap<>();
globalUpdates.put("schedKey1", "schedVal1");
schedUpdateInfo.setGlobalParams(globalUpdates);

LogMutation log = provider.logAndApplyMutation(
UserGroupInformation.getCurrentUser(), schedUpdateInfo);
rm.getRMContext().getRMAdminService().refreshQueues();
provider.confirmPendingMutation(log, true);

Configuration schedulerConf = provider.getConfiguration();
assertEquals("schedVal1", schedulerConf.get("schedKey1"));

int exitCode = cli.formatSchedulerConf("", target());
assertEquals(0, exitCode);

schedulerConf = provider.getConfiguration();
assertNull(schedulerConf.get("schedKey1"));
} finally {
cleanUp();
}

ResourceScheduler scheduler = rm.getResourceScheduler();
MutableConfigurationProvider provider =
((MutableConfScheduler) scheduler).getMutableConfProvider();

SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo();
HashMap<String, String> globalUpdates = new HashMap<>();
globalUpdates.put("schedKey1", "schedVal1");
schedUpdateInfo.setGlobalParams(globalUpdates);

LogMutation log = provider.logAndApplyMutation(
UserGroupInformation.getCurrentUser(), schedUpdateInfo);
rm.getRMContext().getRMAdminService().refreshQueues();
provider.confirmPendingMutation(log, true);

Configuration schedulerConf = provider.getConfiguration();
assertEquals("schedVal1", schedulerConf.get("schedKey1"));

int exitCode = cli.formatSchedulerConf("", target());
assertEquals(0, exitCode);

schedulerConf = provider.getConfiguration();
assertNull(schedulerConf.get("schedKey1"));
}

@Test(timeout = 10000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,4 @@ public static ContainerId createContainerId(int cId, int aId) {
ContainerId.newContainerId(appAttemptId, cId);
return containerId;
}


}

0 comments on commit 20785c9

Please sign in to comment.