YARN-5317. testAMRestartNotLostContainerCompleteMsg may fail. Contributed by sandflee
This commit is contained in:
parent
7705812c7e
commit
10b704c594
@ -741,7 +741,12 @@ public FailApplicationAttemptResponse failApplicationAttempt(
|
|||||||
return client.failApplicationAttempt(req);
|
return client.failApplicationAttempt(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from AMLauncher
|
/**
|
||||||
|
* recommend to use launchAM, or use sendAMLaunched like:
|
||||||
|
* 1, wait RMAppAttempt scheduled
|
||||||
|
* 2, send node heartbeat
|
||||||
|
* 3, sendAMLaunched
|
||||||
|
*/
|
||||||
public MockAM sendAMLaunched(ApplicationAttemptId appAttemptId)
|
public MockAM sendAMLaunched(ApplicationAttemptId appAttemptId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
MockAM am = new MockAM(getRMContext(), masterService, appAttemptId);
|
MockAM am = new MockAM(getRMContext(), masterService, appAttemptId);
|
||||||
|
@ -149,12 +149,11 @@ public void testAMRestartWithExistingContainers() throws Exception {
|
|||||||
Assert.assertFalse(newAttemptId.equals(am1.getApplicationAttemptId()));
|
Assert.assertFalse(newAttemptId.equals(am1.getApplicationAttemptId()));
|
||||||
|
|
||||||
// launch the new AM
|
// launch the new AM
|
||||||
RMAppAttempt attempt2 = app1.getCurrentAppAttempt();
|
MockAM am2 = rm1.launchAM(app1, rm1, nm1);
|
||||||
nm1.nodeHeartbeat(true);
|
|
||||||
MockAM am2 = rm1.sendAMLaunched(attempt2.getAppAttemptId());
|
|
||||||
RegisterApplicationMasterResponse registerResponse =
|
RegisterApplicationMasterResponse registerResponse =
|
||||||
am2.registerAppAttempt();
|
am2.registerAppAttempt();
|
||||||
|
|
||||||
|
|
||||||
// Assert two containers are running: container2 and container3;
|
// Assert two containers are running: container2 and container3;
|
||||||
Assert.assertEquals(2, registerResponse.getContainersFromPreviousAttempts()
|
Assert.assertEquals(2, registerResponse.getContainersFromPreviousAttempts()
|
||||||
.size());
|
.size());
|
||||||
@ -837,10 +836,7 @@ public void testAMRestartNotLostContainerCompleteMsg() throws Exception {
|
|||||||
|
|
||||||
// launch the new AM
|
// launch the new AM
|
||||||
RMAppAttempt attempt2 = app1.getCurrentAppAttempt();
|
RMAppAttempt attempt2 = app1.getCurrentAppAttempt();
|
||||||
nm1.nodeHeartbeat(true);
|
MockAM am2 = rm1.launchAndRegisterAM(app1, rm1, nm1);
|
||||||
MockAM am2 = rm1.sendAMLaunched(attempt2.getAppAttemptId());
|
|
||||||
am2.registerAppAttempt();
|
|
||||||
rm1.waitForState(app1.getApplicationId(), RMAppState.RUNNING);
|
|
||||||
|
|
||||||
// whether new AM could get container complete msg
|
// whether new AM could get container complete msg
|
||||||
AllocateResponse allocateResponse = am2.allocate(
|
AllocateResponse allocateResponse = am2.allocate(
|
||||||
|
Loading…
Reference in New Issue
Block a user