Esempio n. 1
0
 @Test(timeout = 60000)
 public void testAdd() {
   RMNodeImpl node = getNewNode();
   ClusterMetrics cm = ClusterMetrics.getMetrics();
   int initialActive = cm.getNumActiveNMs();
   int initialLost = cm.getNumLostNMs();
   int initialUnhealthy = cm.getUnhealthyNMs();
   int initialDecommissioned = cm.getNumDecommisionedNMs();
   int initialRebooted = cm.getNumRebootedNMs();
   node.handle(new RMNodeEvent(node.getNodeID(), RMNodeEventType.STARTED, null));
   Assert.assertEquals("Active Nodes", initialActive + 1, cm.getNumActiveNMs());
   Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
   Assert.assertEquals("Unhealthy Nodes", initialUnhealthy, cm.getUnhealthyNMs());
   Assert.assertEquals("Decommissioned Nodes", initialDecommissioned, cm.getNumDecommisionedNMs());
   Assert.assertEquals("Rebooted Nodes", initialRebooted, cm.getNumRebootedNMs());
   Assert.assertEquals(NodeState.RUNNING, node.getState());
   Assert.assertNotNull(nodesListManagerEvent);
   Assert.assertEquals(NodesListManagerEventType.NODE_USABLE, nodesListManagerEvent.getType());
 }
Esempio n. 2
0
 @Test(timeout = 60000)
 public void testReconnect() throws IOException {
   RMNodeImpl node = getRunningNode();
   ClusterMetrics cm = ClusterMetrics.getMetrics();
   int initialActive = cm.getNumActiveNMs();
   int initialLost = cm.getNumLostNMs();
   int initialUnhealthy = cm.getUnhealthyNMs();
   int initialDecommissioned = cm.getNumDecommisionedNMs();
   int initialRebooted = cm.getNumRebootedNMs();
   node.handle(
       new RMNodeReconnectEvent(
           node.getNodeID(), node, new TransactionStateImpl(TransactionType.RM)));
   Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
   Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
   Assert.assertEquals("Unhealthy Nodes", initialUnhealthy, cm.getUnhealthyNMs());
   Assert.assertEquals("Decommissioned Nodes", initialDecommissioned, cm.getNumDecommisionedNMs());
   Assert.assertEquals("Rebooted Nodes", initialRebooted, cm.getNumRebootedNMs());
   Assert.assertEquals(NodeState.RUNNING, node.getState());
   Assert.assertNotNull(nodesListManagerEvent);
   Assert.assertEquals(NodesListManagerEventType.NODE_USABLE, nodesListManagerEvent.getType());
 }
Esempio n. 3
0
 @Test(timeout = 60000)
 public void testUnhealthyRebooting() throws IOException {
   RMNodeImpl node = getUnhealthyNode();
   ClusterMetrics cm = ClusterMetrics.getMetrics();
   int initialActive = cm.getNumActiveNMs();
   int initialLost = cm.getNumLostNMs();
   int initialUnhealthy = cm.getUnhealthyNMs();
   int initialDecommissioned = cm.getNumDecommisionedNMs();
   int initialRebooted = cm.getNumRebootedNMs();
   node.handle(
       new RMNodeEvent(
           node.getNodeID(),
           RMNodeEventType.REBOOTING,
           new TransactionStateImpl(TransactionType.RM)));
   Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
   Assert.assertEquals("Lost Nodes", initialLost, cm.getNumLostNMs());
   Assert.assertEquals("Unhealthy Nodes", initialUnhealthy - 1, cm.getUnhealthyNMs());
   Assert.assertEquals("Decommissioned Nodes", initialDecommissioned, cm.getNumDecommisionedNMs());
   Assert.assertEquals("Rebooted Nodes", initialRebooted + 1, cm.getNumRebootedNMs());
   Assert.assertEquals(NodeState.REBOOTED, node.getState());
 }