From c351230d0ea2d37f72a2c59162b23e110dead738 Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Tue, 6 Feb 2018 19:33:04 +0800 Subject: [PATCH] YARN-7860. Fix UT failure TestRMWebServiceAppsNodelabel#testAppsRunning. Contributed by Sunil G. (cherry picked from commit bff858e910f69991e6c75151d9b89c3e78210f16) --- .../webapp/TestRMWebServiceAppsNodelabel.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServiceAppsNodelabel.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServiceAppsNodelabel.java index ff48c7a9aa3..433c0846129 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServiceAppsNodelabel.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServiceAppsNodelabel.java @@ -217,13 +217,18 @@ public class TestRMWebServiceAppsNodelabel extends JerseyTestBase { private void verifyResource(JSONObject partition, String partitionName, String amused, String used, String reserved) throws JSONException { + JSONObject amusedObject = (JSONObject) partition.get("amUsed"); + JSONObject usedObject = (JSONObject) partition.get("used"); + JSONObject reservedObject = (JSONObject) partition.get("reserved"); assertEquals("Partition expected", partitionName, partition.get("partitionName")); - assertEquals("partition amused", amused, - partition.get("amUsed").toString()); - assertEquals("partition used", used, partition.get("used").toString()); + assertEquals("partition amused", amused, getResource( + (int) amusedObject.get("memory"), (int) amusedObject.get("vCores"))); + assertEquals("partition used", used, getResource( + (int) usedObject.get("memory"), (int) usedObject.get("vCores"))); assertEquals("partition reserved", reserved, - partition.get("reserved").toString()); + getResource((int) reservedObject.get("memory"), + (int) reservedObject.get("vCores"))); } @SuppressWarnings("unchecked")