diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java index d02822791b..2c37f44e41 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java @@ -1324,11 +1324,11 @@ public void testContainerCompleteMsgNotLostAfterAMFailedAndRMRestart() throws Ex nm1.nodeHeartbeat(true); List conts = am0.allocate(new ArrayList(), new ArrayList()).getAllocatedContainers(); - while (conts.size() == 0) { + while (conts.size() < 2) { nm1.nodeHeartbeat(true); conts.addAll(am0.allocate(new ArrayList(), new ArrayList()).getAllocatedContainers()); - Thread.sleep(500); + Thread.sleep(100); } // am failed,and relaunch it @@ -1426,14 +1426,12 @@ public void testUAMRecoveryOnRMWorkPreservingRestart() throws Exception { nm1.nodeHeartbeat(true); List conts = am0.allocate(new ArrayList(), new ArrayList()).getAllocatedContainers(); - Assert.assertTrue(conts.isEmpty()); - while (conts.size() == 0) { + while (conts.size() < 2) { nm1.nodeHeartbeat(true); conts.addAll(am0.allocate(new ArrayList(), new ArrayList()).getAllocatedContainers()); - Thread.sleep(500); + Thread.sleep(100); } - Assert.assertFalse(conts.isEmpty()); // start new RM rm2 = new MockRM(conf, rm1.getRMStateStore());