YARN-2799. Cleanup TestLogAggregationService based on the change in YARN-90. Contributed by Zhihai Xu

(cherry picked from commit c33ae271c2)
This commit is contained in:
Junping Du 2015-02-20 09:43:39 -08:00
parent 3e8dfd1299
commit 4a87a61fe9
2 changed files with 6 additions and 22 deletions

View File

@ -271,6 +271,9 @@ Release 2.7.0 - UNRELEASED
YARN-3076. Add API/Implementation to YarnClient to retrieve label-to-node YARN-3076. Add API/Implementation to YarnClient to retrieve label-to-node
mapping. (Varun Saxena via wangda) mapping. (Varun Saxena via wangda)
YARN-2799. Cleanup TestLogAggregationService based on the change in YARN-90.
(Zhihai Xu via junping_du)
OPTIMIZATIONS OPTIMIZATIONS
YARN-2990. FairScheduler's delay-scheduling always waits for node-local and YARN-2990. FairScheduler's delay-scheduling always waits for node-local and

View File

@ -248,7 +248,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
}; };
checkEvents(appEventHandler, expectedEvents, true, "getType", "getApplicationID"); checkEvents(appEventHandler, expectedEvents, true, "getType", "getApplicationID");
dispatcher.stop();
} }
@Test @Test
@ -295,7 +294,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED) ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED)
}; };
checkEvents(appEventHandler, expectedEvents, true, "getType", "getApplicationID"); checkEvents(appEventHandler, expectedEvents, true, "getType", "getApplicationID");
dispatcher.stop();
logAggregationService.close(); logAggregationService.close();
} }
@ -308,9 +306,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
this.remoteRootLogDir.getAbsolutePath()); this.remoteRootLogDir.getAbsolutePath());
String[] fileNames = new String[] { "stdout", "stderr", "syslog" }; String[] fileNames = new String[] { "stdout", "stderr", "syslog" };
DrainDispatcher dispatcher = createDispatcher();
EventHandler<ApplicationEvent> appEventHandler = mock(EventHandler.class);
dispatcher.register(ApplicationEventType.class, appEventHandler);
LogAggregationService logAggregationService = LogAggregationService logAggregationService =
new LogAggregationService(dispatcher, this.context, this.delSrvc, new LogAggregationService(dispatcher, this.context, this.delSrvc,
@ -441,7 +436,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED) ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED)
}; };
checkEvents(appEventHandler, expectedFinishedEvents, false, "getType", "getApplicationID"); checkEvents(appEventHandler, expectedFinishedEvents, false, "getType", "getApplicationID");
dispatcher.stop();
} }
@Test @Test
@ -519,7 +513,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
aNewFile.getAbsolutePath()); aNewFile.getAbsolutePath());
DrainDispatcher dispatcher = createDispatcher();
LogAggregationService logAggregationService = spy( LogAggregationService logAggregationService = spy(
new LogAggregationService(dispatcher, this.context, this.delSrvc, new LogAggregationService(dispatcher, this.context, this.delSrvc,
super.dirsHandler)); super.dirsHandler));
@ -590,6 +583,7 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
verify(spyFs, never()).mkdirs(eq(appDir3), isA(FsPermission.class)); verify(spyFs, never()).mkdirs(eq(appDir3), isA(FsPermission.class));
aggSvc.stop(); aggSvc.stop();
aggSvc.close(); aggSvc.close();
dispatcher.stop();
} }
@Test @Test
@ -1122,10 +1116,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
this.remoteRootLogDir.getAbsolutePath()); this.remoteRootLogDir.getAbsolutePath());
DrainDispatcher dispatcher = createDispatcher();
EventHandler<ApplicationEvent> appEventHandler = mock(EventHandler.class);
dispatcher.register(ApplicationEventType.class, appEventHandler);
ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1); ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1);
ApplicationId application2 = BuilderUtils.newApplicationId(1234, 2); ApplicationId application2 = BuilderUtils.newApplicationId(1234, 2);
ApplicationId application3 = BuilderUtils.newApplicationId(1234, 3); ApplicationId application3 = BuilderUtils.newApplicationId(1234, 3);
@ -1282,7 +1272,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED) }; ApplicationEventType.APPLICATION_LOG_HANDLING_FINISHED) };
checkEvents(appEventHandler, expectedFinishedEvents, false, "getType", checkEvents(appEventHandler, expectedFinishedEvents, false, "getType",
"getApplicationID"); "getApplicationID");
dispatcher.stop();
} }
@Test (timeout = 50000) @Test (timeout = 50000)
@ -1319,10 +1308,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
// again in next cycle. // again in next cycle.
this.conf.setLong(YarnConfiguration.DEBUG_NM_DELETE_DELAY_SEC, 3600); this.conf.setLong(YarnConfiguration.DEBUG_NM_DELETE_DELAY_SEC, 3600);
DrainDispatcher dispatcher = createDispatcher();
EventHandler<ApplicationEvent> appEventHandler = mock(EventHandler.class);
dispatcher.register(ApplicationEventType.class, appEventHandler);
ApplicationId application = BuilderUtils.newApplicationId(123456, 1); ApplicationId application = BuilderUtils.newApplicationId(123456, 1);
ApplicationAttemptId appAttemptId = ApplicationAttemptId appAttemptId =
BuilderUtils.newApplicationAttemptId(application, 1); BuilderUtils.newApplicationAttemptId(application, 1);
@ -1426,7 +1411,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
new ContainerId[] { container }, logFiles3, 3, true); new ContainerId[] { container }, logFiles3, 3, true);
logAggregationService.stop(); logAggregationService.stop();
assertEquals(0, logAggregationService.getNumAggregators()); assertEquals(0, logAggregationService.getNumAggregators());
dispatcher.stop();
} }
@ -1436,8 +1420,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
"kerberos"); "kerberos");
UserGroupInformation.setConfiguration(conf); UserGroupInformation.setConfiguration(conf);
DrainDispatcher dispatcher = createDispatcher();
dispatcher.register(ApplicationEventType.class, appEventHandler);
ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1); ApplicationId application1 = BuilderUtils.newApplicationId(1234, 1);
Application mockApp = mock(Application.class); Application mockApp = mock(Application.class);
@ -1484,7 +1466,6 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
} }
}, 1000, 20000); }, 1000, 20000);
logAggregationService.stop(); logAggregationService.stop();
dispatcher.stop();
} }
private int numOfLogsAvailable(LogAggregationService logAggregationService, private int numOfLogsAvailable(LogAggregationService logAggregationService,