@Test
public void testUnhealthyNodeStatus() throws Exception {

  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH, hostFile
      .getAbsolutePath());
  rm = new MockRM(conf);
  rm.start();
  MockNM nm1 = rm.registerNode("host1:1234", 5120);
  Assert.assertEquals(0, ClusterMetrics.getMetrics().getUnhealthyNMs());
  // node healthy
  nm1.nodeHeartbeat(true);
  // node unhealthy
  nm1.nodeHeartbeat(false);
  checkUnealthyNMCount(rm, nm1, true, 1);
  // node healthy again
  nm1.nodeHeartbeat(true);
  checkUnealthyNMCount(rm, nm1, false, 0);
}