|
@@ -115,6 +115,7 @@ public class TestSystemMetricsPublisher {
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, i);
|
|
|
RMApp app = createRMApp(appId);
|
|
|
metricsPublisher.appCreated(app, app.getStartTime());
|
|
|
+ metricsPublisher.appLaunched(app, app.getLaunchTime());
|
|
|
if (i == 1) {
|
|
|
when(app.getQueue()).thenReturn("new test queue");
|
|
|
ApplicationSubmissionContext asc = mock(
|
|
@@ -150,7 +151,7 @@ public class TestSystemMetricsPublisher {
|
|
|
ApplicationMetricsConstants.ENTITY_TYPE,
|
|
|
EnumSet.allOf(Field.class));
|
|
|
// ensure Five events are both published before leaving the loop
|
|
|
- } while (entity == null || entity.getEvents().size() < 5);
|
|
|
+ } while (entity == null || entity.getEvents().size() < 6);
|
|
|
// verify all the fields
|
|
|
Assert.assertEquals(ApplicationMetricsConstants.ENTITY_TYPE,
|
|
|
entity.getEntityType());
|
|
@@ -240,6 +241,7 @@ public class TestSystemMetricsPublisher {
|
|
|
Assert.assertEquals("context", entity.getOtherInfo()
|
|
|
.get(ApplicationMetricsConstants.YARN_APP_CALLER_CONTEXT));
|
|
|
boolean hasCreatedEvent = false;
|
|
|
+ boolean hasLaunchedEvent = false;
|
|
|
boolean hasUpdatedEvent = false;
|
|
|
boolean hasFinishedEvent = false;
|
|
|
boolean hasACLsUpdatedEvent = false;
|
|
@@ -249,6 +251,10 @@ public class TestSystemMetricsPublisher {
|
|
|
ApplicationMetricsConstants.CREATED_EVENT_TYPE)) {
|
|
|
hasCreatedEvent = true;
|
|
|
Assert.assertEquals(app.getStartTime(), event.getTimestamp());
|
|
|
+ } else if (event.getEventType().equals(
|
|
|
+ ApplicationMetricsConstants.LAUNCHED_EVENT_TYPE)) {
|
|
|
+ hasLaunchedEvent = true;
|
|
|
+ Assert.assertEquals(app.getLaunchTime(), event.getTimestamp());
|
|
|
} else if (event.getEventType().equals(
|
|
|
ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) {
|
|
|
hasFinishedEvent = true;
|
|
@@ -292,6 +298,7 @@ public class TestSystemMetricsPublisher {
|
|
|
}
|
|
|
// Do assertTrue verification separately for easier debug
|
|
|
Assert.assertTrue(hasCreatedEvent);
|
|
|
+ Assert.assertTrue(hasLaunchedEvent);
|
|
|
Assert.assertTrue(hasFinishedEvent);
|
|
|
Assert.assertTrue(hasACLsUpdatedEvent);
|
|
|
Assert.assertTrue(hasUpdatedEvent);
|
|
@@ -499,6 +506,7 @@ public class TestSystemMetricsPublisher {
|
|
|
when(app.getQueue()).thenReturn("test queue");
|
|
|
when(app.getSubmitTime()).thenReturn(Integer.MAX_VALUE + 1L);
|
|
|
when(app.getStartTime()).thenReturn(Integer.MAX_VALUE + 2L);
|
|
|
+ when(app.getLaunchTime()).thenReturn(Integer.MAX_VALUE + 2L);
|
|
|
when(app.getFinishTime()).thenReturn(Integer.MAX_VALUE + 3L);
|
|
|
when(app.getDiagnostics()).thenReturn(
|
|
|
new StringBuilder("test diagnostics info"));
|