Przeglądaj źródła

YARN-7594. TestNMWebServices#testGetNMResourceInfo fails on trunk. Contributed by Gergely Novák.

Sunil G 7 lat temu
rodzic
commit
00821dadcf

+ 4 - 8
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java

@@ -456,18 +456,18 @@ public class TestNMWebServices extends JerseyTestBase {
     assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
     assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
         response.getType().toString());
         response.getType().toString());
 
 
-    // Access resource-2 should fail (null NMResourceInfo returned).
+    // Access resource-2 should fail (empty NMResourceInfo returned).
     JSONObject json = response.getEntity(JSONObject.class);
     JSONObject json = response.getEntity(JSONObject.class);
-    assertIncludesException(json);
+    Assert.assertEquals(0, json.length());
 
 
-    // Access resource-3 should fail (unkown plugin)
+    // Access resource-3 should fail (unknown plugin)
     response = r.path("ws").path("v1").path("node").path(
     response = r.path("ws").path("v1").path("node").path(
         "resources").path("resource-3").accept(MediaType.APPLICATION_JSON).get(
         "resources").path("resource-3").accept(MediaType.APPLICATION_JSON).get(
         ClientResponse.class);
         ClientResponse.class);
     assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
     assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
         response.getType().toString());
         response.getType().toString());
     json = response.getEntity(JSONObject.class);
     json = response.getEntity(JSONObject.class);
-    assertIncludesException(json);
+    Assert.assertEquals(0, json.length());
 
 
     // Access resource-1 should success
     // Access resource-1 should success
     response = r.path("ws").path("v1").path("node").path(
     response = r.path("ws").path("v1").path("node").path(
@@ -537,10 +537,6 @@ public class TestNMWebServices extends JerseyTestBase {
     Assert.assertEquals(2, json.getJSONArray("assignedGpuDevices").length());
     Assert.assertEquals(2, json.getJSONArray("assignedGpuDevices").length());
   }
   }
 
 
-  private void assertIncludesException(JSONObject json) {
-    Assert.assertTrue(json.has("RemoteException"));
-  }
-
   private void testContainerLogs(WebResource r, ContainerId containerId)
   private void testContainerLogs(WebResource r, ContainerId containerId)
       throws IOException {
       throws IOException {
     final String containerIdStr = containerId.toString();
     final String containerIdStr = containerId.toString();