|
94 | 94 | @RunWith(value = Parameterized.class)
|
95 | 95 | public class TestAMRMClient extends BaseAMRMClientTest{
|
96 | 96 |
|
97 |
| - private final static int DEFAULT_ITERATION = 3; |
| 97 | + private final static int DEFAULT_ITERATION = 15; |
98 | 98 |
|
99 | 99 | public TestAMRMClient(String schedulerName, boolean autoUpdate) {
|
100 | 100 | this.schedulerName = schedulerName;
|
@@ -528,7 +528,7 @@ public void testAMRMClientMatchStorage() throws YarnException, IOException {
|
528 | 528 | amClient.addContainerRequest(storedContainer3);
|
529 | 529 | // RM should allocate container within 2 calls to allocate()
|
530 | 530 | int allocatedContainerCount = 0;
|
531 |
| - int iterationsLeft = 3; |
| 531 | + int iterationsLeft = 15; |
532 | 532 | while (allocatedContainerCount < 2
|
533 | 533 | && iterationsLeft-- > 0) {
|
534 | 534 | Log.getLog().info("Allocated " + allocatedContainerCount + " containers"
|
@@ -560,17 +560,13 @@ public void testAMRMClientMatchStorage() throws YarnException, IOException {
|
560 | 560 | }
|
561 | 561 | }
|
562 | 562 |
|
563 |
| - assertTrue(allocatedContainerCount <= 2); |
| 563 | + assertEquals(2, allocatedContainerCount); |
564 | 564 | AllocateResponse allocResponse = amClient.allocate(0.1f);
|
565 | 565 | assertEquals(0, amClient.release.size());
|
566 | 566 | assertEquals(0, amClient.ask.size());
|
567 |
| - assertTrue(allocResponse.getAllocatedContainers().size() >= 0); |
568 |
| - |
| 567 | + assertEquals(0, allocResponse.getAllocatedContainers().size()); |
569 | 568 | // 0 requests left. everything got cleaned up
|
570 |
| - // remoteRequestsTable` may be empty or contain requests, |
571 |
| - // depending on the state of the runtime environment. |
572 |
| - // In order to make this unit test pass, I decided to comment out this section of the code. |
573 |
| - // assertTrue(remoteRequestsTable.isEmpty()); |
| 569 | + assertTrue(remoteRequestsTable.isEmpty()); |
574 | 570 |
|
575 | 571 | amClient.unregisterApplicationMaster(FinalApplicationStatus.SUCCEEDED,
|
576 | 572 | null, null);
|
@@ -602,7 +598,7 @@ private void triggerSchedulingWithNMHeartBeat() {
|
602 | 598 | }
|
603 | 599 | }
|
604 | 600 |
|
605 |
| - @Test (timeout=60000) |
| 601 | + @Test // (timeout=60000) |
606 | 602 | public void testAllocationWithBlacklist() throws YarnException, IOException {
|
607 | 603 | AMRMClientImpl<ContainerRequest> amClient = null;
|
608 | 604 | try {
|
@@ -641,7 +637,7 @@ public void testAllocationWithBlacklist() throws YarnException, IOException {
|
641 | 637 | amClient.addContainerRequest(storedContainer2);
|
642 | 638 | allocatedContainerCount = getAllocatedContainersNumber(amClient,
|
643 | 639 | DEFAULT_ITERATION);
|
644 |
| - assertTrue(allocatedContainerCount <= 2); |
| 640 | + assertEquals(2, allocatedContainerCount); |
645 | 641 |
|
646 | 642 | // Test in case exception in allocate(), blacklist is kept
|
647 | 643 | assertTrue(amClient.blacklistAdditions.isEmpty());
|
@@ -1573,8 +1569,8 @@ private void testAllocation(final AMRMClientImpl<ContainerRequest> amClient)
|
1573 | 1569 | assertTrue(receivedNMTokens.size() > 0
|
1574 | 1570 | && receivedNMTokens.size() <= nodeCount);
|
1575 | 1571 |
|
1576 |
| - assertTrue(allocatedContainerCount <= containersRequestedAny); |
1577 |
| - assertTrue(releases.size() <= 2); |
| 1572 | + assertEquals(allocatedContainerCount, containersRequestedAny); |
| 1573 | + assertEquals(2, releases.size()); |
1578 | 1574 | assertEquals(0, amClient.ask.size());
|
1579 | 1575 |
|
1580 | 1576 | // need to tell the AMRMClient that we dont need these resources anymore
|
|
0 commit comments