diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java index 60027e9..db159eb 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java @@ -19,6 +19,8 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice; import java.io.IOException; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import org.apache.hadoop.conf.Configuration; @@ -97,6 +99,12 @@ public void testApplications() throws IOException, YarnException { clientService.getClientHandler().getApplications(request); List appReport = response.getApplicationList(); Assert.assertNotNull(appReport); + Collections.sort(appReport, new Comparator() { + @Override + public int compare(ApplicationReport o1, ApplicationReport o2) { + return o1.getApplicationId().compareTo(o2.getApplicationId()); + } + }); Assert.assertEquals(appId, appReport.get(0).getApplicationId()); Assert.assertEquals(appId1, appReport.get(1).getApplicationId()); } @@ -131,6 +139,15 @@ public void testApplicationAttempts() throws IOException, YarnException { List attemptReports = response.getApplicationAttemptList(); Assert.assertNotNull(attemptReports); + Collections.sort(attemptReports, + new Comparator() { + @Override + public int compare(ApplicationAttemptReport o1, + ApplicationAttemptReport o2) { + return o1.getApplicationAttemptId() + .compareTo(o2.getApplicationAttemptId()); + } + }); Assert.assertEquals(appAttemptId, attemptReports.get(0) .getApplicationAttemptId()); Assert.assertEquals(appAttemptId1, attemptReports.get(1) @@ -168,7 +185,13 @@ public void testContainers() throws IOException, YarnException { clientService.getClientHandler().getContainers(request); List containers = response.getContainerList(); Assert.assertNotNull(containers); - Assert.assertEquals(containerId, containers.get(1).getContainerId()); - Assert.assertEquals(containerId1, containers.get(0).getContainerId()); + Collections.sort(containers, new Comparator() { + @Override + public int compare(ContainerReport o1, ContainerReport o2) { + return o1.getContainerId().compareTo(o2.getContainerId()); + } + }); + Assert.assertEquals(containerId, containers.get(0).getContainerId()); + Assert.assertEquals(containerId1, containers.get(1).getContainerId()); } }