MAPREDUCE-5749. TestRMContainerAllocator#testReportedAppProgress Failed. Contributed by Jason Lowe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1590046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason Darrell Lowe 2014-04-25 14:53:17 +00:00
parent bce5a92c54
commit 5492149c3c
2 changed files with 7 additions and 3 deletions

View File

@ -189,6 +189,9 @@ Release 2.5.0 - UNRELEASED
MAPREDUCE-5837. MRAppMaster fails when checking on uber mode. (wheat9)
MAPREDUCE-5749. TestRMContainerAllocator#testReportedAppProgress Failed
(jlowe)
Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -122,6 +122,9 @@ public class TestRMContainerAllocator {
public void setup() {
MyContainerAllocator.getJobUpdatedNodeEvents().clear();
MyContainerAllocator.getTaskAttemptKillEvents().clear();
// make each test create a fresh user to avoid leaking tokens between tests
UserGroupInformation.setLoginUser(null);
}
@After
@ -1519,17 +1522,15 @@ protected ApplicationMasterProtocol createSchedulerProxy() {
@Override
protected void register() {
ApplicationAttemptId attemptId = getContext().getApplicationAttemptId();
UserGroupInformation ugi =
UserGroupInformation.createRemoteUser(attemptId.toString());
Token<AMRMTokenIdentifier> token =
rm.getRMContext().getRMApps().get(attemptId.getApplicationId())
.getRMAppAttempt(attemptId).getAMRMToken();
try {
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
ugi.addTokenIdentifier(token.decodeIdentifier());
} catch (IOException e) {
throw new YarnRuntimeException(e);
}
UserGroupInformation.setLoginUser(ugi);
super.register();
}