|
@@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.webapp.WebServicesTestUtils;
|
|
import org.codehaus.jettison.json.JSONException;
|
|
import org.codehaus.jettison.json.JSONException;
|
|
import org.codehaus.jettison.json.JSONObject;
|
|
import org.codehaus.jettison.json.JSONObject;
|
|
import org.junit.Before;
|
|
import org.junit.Before;
|
|
|
|
+import org.junit.BeforeClass;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Element;
|
|
import org.w3c.dom.Element;
|
|
@@ -109,6 +110,16 @@ public class TestRMWebServices extends JerseyTest {
|
|
.contextPath("jersey-guice-filter").servletPath("/").build());
|
|
.contextPath("jersey-guice-filter").servletPath("/").build());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @BeforeClass
|
|
|
|
+ public static void initClusterMetrics() {
|
|
|
|
+ ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();
|
|
|
|
+ clusterMetrics.incrDecommisionedNMs();
|
|
|
|
+ clusterMetrics.incrNumActiveNodes();
|
|
|
|
+ clusterMetrics.incrNumLostNMs();
|
|
|
|
+ clusterMetrics.incrNumRebootedNMs();
|
|
|
|
+ clusterMetrics.incrNumUnhealthyNMs();
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void testInfoXML() throws JSONException, Exception {
|
|
public void testInfoXML() throws JSONException, Exception {
|
|
WebResource r = resource();
|
|
WebResource r = resource();
|
|
@@ -426,7 +437,8 @@ public class TestRMWebServices extends JerseyTest {
|
|
"totalNodes doesn't match",
|
|
"totalNodes doesn't match",
|
|
clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs()
|
|
clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs()
|
|
+ clusterMetrics.getNumDecommisionedNMs()
|
|
+ clusterMetrics.getNumDecommisionedNMs()
|
|
- + clusterMetrics.getNumRebootedNMs(), totalNodes);
|
|
|
|
|
|
+ + clusterMetrics.getNumRebootedNMs()
|
|
|
|
+ + clusterMetrics.getUnhealthyNMs(), totalNodes);
|
|
assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(),
|
|
assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(),
|
|
lostNodes);
|
|
lostNodes);
|
|
assertEquals("unhealthyNodes doesn't match",
|
|
assertEquals("unhealthyNodes doesn't match",
|