|
@@ -163,7 +163,21 @@ public class TestRMNodeTransitions {
|
|
|
@Test
|
|
|
public void testUnhealthyExpire() {
|
|
|
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.EXPIRE));
|
|
|
+ Assert.assertEquals("Active Nodes", initialActive, cm.getNumActiveNMs());
|
|
|
+ Assert.assertEquals("Lost Nodes", initialLost + 1, cm.getNumLostNMs());
|
|
|
+ Assert.assertEquals("Unhealthy Nodes",
|
|
|
+ initialUnhealthy - 1, cm.getUnhealthyNMs());
|
|
|
+ Assert.assertEquals("Decommissioned Nodes",
|
|
|
+ initialDecommissioned, cm.getNumDecommisionedNMs());
|
|
|
+ Assert.assertEquals("Rebooted Nodes",
|
|
|
+ initialRebooted, cm.getNumRebootedNMs());
|
|
|
Assert.assertEquals(RMNodeState.LOST, node.getState());
|
|
|
}
|
|
|
|
|
@@ -178,8 +192,22 @@ public class TestRMNodeTransitions {
|
|
|
@Test
|
|
|
public void testUnhealthyDecommission() {
|
|
|
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.DECOMMISSION));
|
|
|
+ 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 + 1, cm.getNumDecommisionedNMs());
|
|
|
+ Assert.assertEquals("Rebooted Nodes",
|
|
|
+ initialRebooted, cm.getNumRebootedNMs());
|
|
|
Assert.assertEquals(RMNodeState.DECOMMISSIONED, node.getState());
|
|
|
}
|
|
|
|
|
@@ -194,8 +222,22 @@ public class TestRMNodeTransitions {
|
|
|
@Test
|
|
|
public void testUnhealthyRebooting() {
|
|
|
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));
|
|
|
+ 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(RMNodeState.REBOOTED, node.getState());
|
|
|
}
|
|
|
|