YARN-1830. Fixed TestRMRestart#testQueueMetricsOnRMRestart failure due to race condition when app is submitted. Contributed by Zhijie Shen

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1578486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jian He 2014-03-17 18:03:06 +00:00
parent 809e8bf5b7
commit bc00bc966b
2 changed files with 8 additions and 6 deletions

View File

@ -489,6 +489,9 @@ Release 2.4.0 - UNRELEASED
YARN-1789. ApplicationSummary does not escape newlines in the app name
(Tsuyoshi OZAWA via jlowe)
YARN-1830. Fixed TestRMRestart#testQueueMetricsOnRMRestart failure due to
race condition when app is submitted. (Zhijie Shen via jianhe)
Release 2.3.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -1614,7 +1614,7 @@ public class TestRMRestart {
}
@SuppressWarnings("resource")
@Test
@Test (timeout = 60000)
public void testQueueMetricsOnRMRestart() throws Exception {
conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS,
YarnConfiguration.DEFAULT_RM_AM_MAX_ATTEMPTS);
@ -1674,15 +1674,14 @@ public class TestRMRestart {
ContainerState.COMPLETE, "Killed AM container", 143);
containerStatuses.add(containerStatus);
nm1.registerNode(containerStatuses);
int timeoutSecs = 0;
while (loadedApp1.getAppAttempts().size() != 2 && timeoutSecs++ < 40) {;
while (loadedApp1.getAppAttempts().size() != 2) {
Thread.sleep(200);
}
assertQueueMetrics(qm2, 1, 1, 0, 0);
nm1.nodeHeartbeat(true);
attempt1 = loadedApp1.getCurrentAppAttempt();
attemptId1 = attempt1.getAppAttemptId();
rm2.waitForState(attemptId1, RMAppAttemptState.SCHEDULED);
assertQueueMetrics(qm2, 1, 1, 0, 0);
nm1.nodeHeartbeat(true);
rm2.waitForState(attemptId1, RMAppAttemptState.ALLOCATED);
assertQueueMetrics(qm2, 1, 0, 1, 0);
am1 = rm2.sendAMLaunched(attempt1.getAppAttemptId());