Search in sources :

Example 1 with NodeStateOrHostInfoChangeHandler

use of com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler in project vespa by vespa-engine.

the class GroupAutoTakedownTest method transient_maintenance_mode_on_down_edge_does_not_take_down_group.

@Test
public void transient_maintenance_mode_on_down_edge_does_not_take_down_group() {
    ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.99);
    fixture.enableTransientMaintenanceModeOnDown(1000);
    // Our timers are mocked, so taking down node 4 will deterministically transition to
    // a transient maintenance mode. Group should not be taken down here.
    assertEquals("distributor:9 storage:9 .4.s:m", stateAfterStorageTransition(fixture, 4, State.DOWN));
    // However, once grace period expires the group should be taken down.
    fixture.timer.advanceTime(1001);
    NodeStateOrHostInfoChangeHandler changeListener = mock(NodeStateOrHostInfoChangeHandler.class);
    fixture.nodeStateChangeHandler.watchTimers(fixture.cluster, fixture.annotatedGeneratedClusterState().getClusterState(), changeListener);
    assertEquals("distributor:9 storage:9 .3.s:d .4.s:d .5.s:d", fixture.generatedClusterState());
}
Also used : NodeStateOrHostInfoChangeHandler(com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler) Test(org.junit.Test)

Example 2 with NodeStateOrHostInfoChangeHandler

use of com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler in project vespa by vespa-engine.

the class ClusterFixture method doReportNodeState.

private void doReportNodeState(final Node node, final NodeState nodeState) {
    final ClusterState stateBefore = rawGeneratedClusterState();
    NodeStateOrHostInfoChangeHandler handler = mock(NodeStateOrHostInfoChangeHandler.class);
    NodeInfo nodeInfo = cluster.getNodeInfo(node);
    nodeStateChangeHandler.handleNewReportedNodeState(stateBefore, nodeInfo, nodeState, handler);
    nodeInfo.setReportedState(nodeState, timer.getCurrentTimeInMillis());
}
Also used : ClusterState(com.yahoo.vdslib.state.ClusterState) NodeStateOrHostInfoChangeHandler(com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler)

Aggregations

NodeStateOrHostInfoChangeHandler (com.yahoo.vespa.clustercontroller.core.listeners.NodeStateOrHostInfoChangeHandler)2 ClusterState (com.yahoo.vdslib.state.ClusterState)1 Test (org.junit.Test)1