Przeglądaj źródła

YARN-9315. TestCapacitySchedulerMetrics fails intermittently. Contributed by Prabhu Joseph.

Weiwei Yang 6 lat temu
rodzic
commit
eedcc8e26e

+ 6 - 6
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestCapacitySchedulerMetrics.java

@@ -87,18 +87,18 @@ public class TestCapacitySchedulerMetrics {
     nm1.nodeHeartbeat(true);
     nm1.nodeHeartbeat(true);
     nm2.nodeHeartbeat(true);
     nm2.nodeHeartbeat(true);
 
 
-    // Verify HB metrics updated
     try {
     try {
+      // Verify HB metrics updated
       GenericTestUtils.waitFor(()
       GenericTestUtils.waitFor(()
           -> csMetrics.getNumOfNodeUpdate() == 4, 100, 3000);
           -> csMetrics.getNumOfNodeUpdate() == 4, 100, 3000);
+      // For async mode, the number of alloc might be bigger than 1
+      Assert.assertTrue(csMetrics.getNumOfAllocates() > 0);
+      // But there will be only 2 successful commit (1 AM + 1 task)
+      GenericTestUtils.waitFor(()
+          -> csMetrics.getNumOfCommitSuccess() == 2, 100, 3000);
     } catch(TimeoutException e) {
     } catch(TimeoutException e) {
       Assert.fail("CS metrics not updated on node-update events.");
       Assert.fail("CS metrics not updated on node-update events.");
     }
     }
-
-    // For async mode, the number of alloc might be bigger than 1
-    Assert.assertTrue(csMetrics.getNumOfAllocates() > 0);
-    // But there will be only 2 successful commit (1 AM + 1 task)
-    Assert.assertEquals(2, csMetrics.getNumOfCommitSuccess());
   }
   }
 
 
   @After
   @After