diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 38d16ca66f4..a2b251f616e 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -44,6 +44,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 diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRMContainerAllocator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRMContainerAllocator.java index 27eb9760e6e..8e0f7f8960c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRMContainerAllocator.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRMContainerAllocator.java @@ -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(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index 815f96a8266..704edc63062 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -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);