MAPREDUCE-5514. Fix TestRMContainerAllocator. Contributed by Zhijie Shen.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1526735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2013-09-26 23:02:51 +00:00
parent c2634123c3
commit 96c11fe602
3 changed files with 18 additions and 1 deletions

View File

@ -181,6 +181,8 @@ Release 2.3.0 - UNRELEASED
MAPREDUCE-5522. Incorrect oreder expected from JobQueueInfo (Jinghui Wang
via bobby)
MAPREDUCE-5514. Fix TestRMContainerAllocator. (Zhijie Shen via acmurthy)
Release 2.2.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -432,11 +432,21 @@ public class TestRMContainerAllocator {
}
private static class MyResourceManager extends MockRM {
private static long fakeClusterTimeStamp = System.currentTimeMillis();
public MyResourceManager(Configuration conf) {
super(conf);
}
@Override
public void serviceStart() throws Exception {
super.serviceStart();
// Ensure that the application attempt IDs for all the tests are the same
// The application attempt IDs will be used as the login user names
MyResourceManager.setClusterTimeStamp(fakeClusterTimeStamp);
}
@Override
protected Dispatcher createDispatcher() {
return new DrainDispatcher();

View File

@ -168,7 +168,12 @@ public class ResourceManager extends CompositeService implements Recoverable {
public static long getClusterTimeStamp() {
return clusterTimeStamp;
}
@VisibleForTesting
protected static void setClusterTimeStamp(long timestamp) {
clusterTimeStamp = timestamp;
}
@Override
protected void serviceInit(Configuration conf) throws Exception {
validateConfigs(conf);