|
@@ -172,22 +172,11 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
|
|
|
dispatcher.close();
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void testLocalFileDeletionAfterUpload() throws Exception {
|
|
|
- this.delSrvc = new DeletionService(createContainerExecutor());
|
|
|
- delSrvc = spy(delSrvc);
|
|
|
- this.delSrvc.init(conf);
|
|
|
- this.conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
|
|
|
- this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
|
|
|
- this.remoteRootLogDir.getAbsolutePath());
|
|
|
-
|
|
|
- LogAggregationService logAggregationService = spy(
|
|
|
- new LogAggregationService(dispatcher, this.context, this.delSrvc,
|
|
|
- super.dirsHandler));
|
|
|
+ private void verifyLocalFileDeletion(
|
|
|
+ LogAggregationService logAggregationService) throws Exception {
|
|
|
logAggregationService.init(this.conf);
|
|
|
logAggregationService.start();
|
|
|
|
|
|
-
|
|
|
ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1);
|
|
|
|
|
|
// AppLogDir should be created
|
|
@@ -247,9 +236,46 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
|
|
|
ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED)
|
|
|
};
|
|
|
|
|
|
- checkEvents(appEventHandler, expectedEvents, true, "getType", "getApplicationID");
|
|
|
+ checkEvents(appEventHandler, expectedEvents, true, "getType",
|
|
|
+ "getApplicationID");
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testLocalFileDeletionAfterUpload() throws Exception {
|
|
|
+ this.delSrvc = new DeletionService(createContainerExecutor());
|
|
|
+ delSrvc = spy(delSrvc);
|
|
|
+ this.delSrvc.init(conf);
|
|
|
+ this.conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
|
|
|
+ this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
|
|
|
+ this.remoteRootLogDir.getAbsolutePath());
|
|
|
+
|
|
|
+ LogAggregationService logAggregationService = spy(
|
|
|
+ new LogAggregationService(dispatcher, this.context, this.delSrvc,
|
|
|
+ super.dirsHandler));
|
|
|
+ verifyLocalFileDeletion(logAggregationService);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testLocalFileDeletionOnDiskFull() throws Exception {
|
|
|
+ this.delSrvc = new DeletionService(createContainerExecutor());
|
|
|
+ delSrvc = spy(delSrvc);
|
|
|
+ this.delSrvc.init(conf);
|
|
|
+ this.conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
|
|
|
+ this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
|
|
|
+ this.remoteRootLogDir.getAbsolutePath());
|
|
|
+ List<String> logDirs = super.dirsHandler.getLogDirs();
|
|
|
+ LocalDirsHandlerService dirsHandler = spy(super.dirsHandler);
|
|
|
+ // Simulate disk being full by returning no good log dirs but having a
|
|
|
+ // directory in full log dirs.
|
|
|
+ when(dirsHandler.getLogDirs()).thenReturn(new ArrayList<String>());
|
|
|
+ when(dirsHandler.getLogDirsForRead()).thenReturn(logDirs);
|
|
|
+ LogAggregationService logAggregationService = spy(
|
|
|
+ new LogAggregationService(dispatcher, this.context, this.delSrvc,
|
|
|
+ dirsHandler));
|
|
|
+ verifyLocalFileDeletion(logAggregationService);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Test
|
|
|
public void testNoContainerOnNode() throws Exception {
|
|
|
this.conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
|