diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestContainerResourceUsage.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestContainerResourceUsage.java index e0221aa..80d9d6d 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestContainerResourceUsage.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestContainerResourceUsage.java @@ -102,7 +102,12 @@ public void testUsageWithOneAttemptAndOneContainer() throws Exception { .getRMContainer(attempt0.getMasterContainer().getId()); // Allow metrics to accumulate. - Thread.sleep(1000); + int sleepInterval = 1000; + int cumulativeSleepTime = 0; + while (rmAppMetrics.getMemorySeconds() <= 0 && cumulativeSleepTime < 5000) { + Thread.sleep(sleepInterval); + cumulativeSleepTime += sleepInterval; + } rmAppMetrics = app0.getRMAppMetrics(); Assert.assertTrue( @@ -127,7 +132,7 @@ public void testUsageWithOneAttemptAndOneContainer() throws Exception { rm.stop(); } - @Test (timeout = 60000) + @Test (timeout = 120000) public void testUsageWithMultipleContainersAndRMRestart() throws Exception { // Set max attempts to 1 so that when the first attempt fails, the app // won't try to start a new one.