YARN-5349. TestWorkPreservingRMRestart#testUAMRecoveryOnRMWorkPreservingRestart fail intermittently. Contributed by Jason Lowe.

This commit is contained in:
Eric Payne 2017-08-02 12:53:22 -05:00
parent 45535f8afa
commit 8ce8672b6b
1 changed files with 4 additions and 6 deletions

View File

@ -1324,11 +1324,11 @@ public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase
nm1.nodeHeartbeat(true); nm1.nodeHeartbeat(true);
List<Container> conts = am0.allocate(new ArrayList<ResourceRequest>(), List<Container> conts = am0.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers(); new ArrayList<ContainerId>()).getAllocatedContainers();
while (conts.size() == 0) { while (conts.size() < 2) {
nm1.nodeHeartbeat(true); nm1.nodeHeartbeat(true);
conts.addAll(am0.allocate(new ArrayList<ResourceRequest>(), conts.addAll(am0.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers()); new ArrayList<ContainerId>()).getAllocatedContainers());
Thread.sleep(500); Thread.sleep(100);
} }
// am failed,and relaunch it // am failed,and relaunch it
@ -1426,14 +1426,12 @@ public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase
nm1.nodeHeartbeat(true); nm1.nodeHeartbeat(true);
List<Container> conts = am0.allocate(new ArrayList<ResourceRequest>(), List<Container> conts = am0.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers(); new ArrayList<ContainerId>()).getAllocatedContainers();
Assert.assertTrue(conts.isEmpty()); while (conts.size() < 2) {
while (conts.size() == 0) {
nm1.nodeHeartbeat(true); nm1.nodeHeartbeat(true);
conts.addAll(am0.allocate(new ArrayList<ResourceRequest>(), conts.addAll(am0.allocate(new ArrayList<ResourceRequest>(),
new ArrayList<ContainerId>()).getAllocatedContainers()); new ArrayList<ContainerId>()).getAllocatedContainers());
Thread.sleep(500); Thread.sleep(100);
} }
Assert.assertFalse(conts.isEmpty());
// start new RM // start new RM
rm2 = new MockRM(conf, rm1.getRMStateStore()); rm2 = new MockRM(conf, rm1.getRMStateStore());