|
@@ -267,7 +267,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(NodeState.LOST, node.getState());
|
|
|
}
|
|
|
|
|
@@ -291,8 +305,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(NodeState.DECOMMISSIONED, node.getState());
|
|
|
}
|
|
|
|
|
@@ -307,8 +335,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(NodeState.REBOOTED, node.getState());
|
|
|
}
|
|
|
|