YARN-7860. Fix UT failure TestRMWebServiceAppsNodelabel#testAppsRunning. Contributed by Sunil G.

This commit is contained in:
Weiwei Yang 2018-02-06 19:33:04 +08:00
parent 72415c39cf
commit bff858e910
1 changed files with 9 additions and 4 deletions

View File

@ -213,13 +213,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")