You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sh...@apache.org on 2018/05/02 19:21:42 UTC

[07/50] [abbrv] hadoop git commit: YARN-8147. TestClientRMService#testGetApplications sporadically fails. Contributed by Jason Lowe

YARN-8147. TestClientRMService#testGetApplications sporadically fails. Contributed by Jason Lowe

(cherry picked from commit 18844599aef42f79d2af4500aa2eee472dda95cb)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7393020c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7393020c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7393020c

Branch: refs/heads/YARN-8200
Commit: 7393020cb35031a406583015591ceedeb6c97bd4
Parents: b0dfb18
Author: Eric E Payne <er...@oath.com>
Authored: Thu Apr 12 17:53:57 2018 +0000
Committer: Eric E Payne <er...@oath.com>
Committed: Thu Apr 12 18:19:12 2018 +0000

----------------------------------------------------------------------
 .../server/resourcemanager/TestClientRMService.java   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7393020c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
index 6946f3c..091bcd9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMService.java
@@ -757,7 +757,7 @@ public class TestClientRMService {
   }
 
   @Test
-  public void testGetApplications() throws IOException, YarnException {
+  public void testGetApplications() throws Exception {
     /**
      * 1. Submit 3 applications alternately in two queues
      * 2. Test each of the filters
@@ -806,8 +806,12 @@ public class TestClientRMService {
       SubmitApplicationRequest submitRequest = mockSubmitAppRequest(
           appId, appNames[i], queues[i % queues.length],
           new HashSet<String>(tags.subList(0, i + 1)));
+      // make sure each app is submitted at a different time
+      Thread.sleep(1);
       rmService.submitApplication(submitRequest);
-      submitTimeMillis[i] = System.currentTimeMillis();
+      submitTimeMillis[i] = rmService.getApplicationReport(
+          GetApplicationReportRequest.newInstance(appId))
+          .getApplicationReport().getStartTime();
     }
 
     // Test different cases of ClientRMService#getApplications()
@@ -822,19 +826,19 @@ public class TestClientRMService {
     
     // Check start range
     request = GetApplicationsRequest.newInstance();
-    request.setStartRange(submitTimeMillis[0], System.currentTimeMillis());
+    request.setStartRange(submitTimeMillis[0] + 1, System.currentTimeMillis());
     
     // 2 applications are submitted after first timeMills
     assertEquals("Incorrect number of matching start range", 
         2, rmService.getApplications(request).getApplicationList().size());
     
     // 1 application is submitted after the second timeMills
-    request.setStartRange(submitTimeMillis[1], System.currentTimeMillis());
+    request.setStartRange(submitTimeMillis[1] + 1, System.currentTimeMillis());
     assertEquals("Incorrect number of matching start range", 
         1, rmService.getApplications(request).getApplicationList().size());
     
     // no application is submitted after the third timeMills
-    request.setStartRange(submitTimeMillis[2], System.currentTimeMillis());
+    request.setStartRange(submitTimeMillis[2] + 1, System.currentTimeMillis());
     assertEquals("Incorrect number of matching start range", 
         0, rmService.getApplications(request).getApplicationList().size());
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org