use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.
the class TestLogsCLI method testInvalidOpts.
@Test(timeout = 1000l)
public void testInvalidOpts() throws Exception {
Configuration conf = new YarnConfiguration();
YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED, UserGroupInformation.getCurrentUser().getShortUserName());
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
cli.setConf(conf);
int exitCode = cli.run(new String[] { "-InvalidOpts" });
assertTrue(exitCode == -1);
assertTrue(sysErrStream.toString().contains("options parsing failed: Unrecognized option: -InvalidOpts"));
}
use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.
the class TestLogsCLI method testInvalidAMContainerId.
@Test(timeout = 5000L)
public void testInvalidAMContainerId() throws Exception {
Configuration conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, true);
YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED, UserGroupInformation.getCurrentUser().getShortUserName());
LogsCLI cli = spy(new LogsCLIForTest(mockYarnClient));
List<JSONObject> list = Arrays.asList(new JSONObject());
doReturn(list).when(cli).getAMContainerInfoForRMWebService(any(Configuration.class), any(String.class));
cli.setConf(conf);
int exitCode = cli.run(new String[] { "-applicationId", "application_1465862913885_0027", "-am", "1000" });
assertTrue(exitCode == -1);
assertTrue(sysErrStream.toString().contains("exceeds the number of AM containers"));
}
use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.
the class TestLogsCLI method testFailResultCodes.
@Test(timeout = 5000l)
public void testFailResultCodes() throws Exception {
Configuration conf = new YarnConfiguration();
conf.setClass("fs.file.impl", LocalFileSystem.class, FileSystem.class);
LogCLIHelpers cliHelper = new LogCLIHelpers();
cliHelper.setConf(conf);
YarnClient mockYarnClient = createMockYarnClient(YarnApplicationState.FINISHED, UserGroupInformation.getCurrentUser().getShortUserName());
LogsCLI dumper = new LogsCLIForTest(mockYarnClient);
dumper.setConf(conf);
// verify dumping a non-existent application's logs returns a failure code
int exitCode = dumper.run(new String[] { "-applicationId", "application_0_0" });
assertTrue("Should return an error code", exitCode != 0);
// verify dumping a non-existent container log is a failure code
exitCode = cliHelper.dumpAContainersLogs("application_0_0", "container_0_0", "nonexistentnode:1234", "nobody");
assertTrue("Should return an error code", exitCode != 0);
}
use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.
the class TestApplicationLifetimeMonitor method setup.
@Before
public void setup() throws IOException {
conf = new YarnConfiguration();
Logger rootLogger = LogManager.getRootLogger();
rootLogger.setLevel(Level.DEBUG);
UserGroupInformation.setConfiguration(conf);
conf.setLong(YarnConfiguration.RM_APPLICATION_MONITOR_INTERVAL_MS, 3000L);
}
use of org.apache.hadoop.yarn.conf.YarnConfiguration in project hadoop by apache.
the class TestNodesListManager method testCachedResolver.
@Test
public void testCachedResolver() throws Exception {
Logger rootLogger = LogManager.getRootLogger();
rootLogger.setLevel(Level.DEBUG);
ControlledClock clock = new ControlledClock();
clock.setTime(0);
final int CACHE_EXPIRY_INTERVAL_SECS = 30;
NodesListManager.CachedResolver resolver = new NodesListManager.CachedResolver(clock, CACHE_EXPIRY_INTERVAL_SECS);
resolver.init(new YarnConfiguration());
resolver.start();
resolver.addToCache("testCachedResolverHost1", "1.1.1.1");
Assert.assertEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
resolver.addToCache("testCachedResolverHost2", "1.1.1.2");
Assert.assertEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
Assert.assertEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
// test removeFromCache
resolver.removeFromCache("testCachedResolverHost1");
Assert.assertNotEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
Assert.assertEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
// test expiry
clock.tickMsec(CACHE_EXPIRY_INTERVAL_SECS * 1000 + 1);
resolver.getExpireChecker().run();
Assert.assertNotEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
Assert.assertNotEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
}
Aggregations