use of functionaltests.monitor.RMMonitorsHandler in project scheduling by ow2-proactive.
the class TestNodeSourceThreadPool method testDownNodesCanStillBeDetectedWhenDeploymentThreadsAreExhausted.
@Test
public void testDownNodesCanStillBeDetectedWhenDeploymentThreadsAreExhausted() throws Exception {
String rmConfig = new File(RMTHelper.class.getResource(TWO_THREADS_CONFIG_FILE_PATH).toURI()).getAbsolutePath();
this.rmHelper.startRM(rmConfig);
this.resourceManager = this.rmHelper.getResourceManager();
this.resourceManager.defineNodeSource(NODE_SOURCE_NAME, SSHInfrastructureV2.class.getName(), getInfiniteRetryInfrastructureParameters(), StaticPolicy.class.getName(), getStaticPolicyParameters(), NODES_NOT_RECOVERABLE);
this.resourceManager.deployNodeSource(NODE_SOURCE_NAME);
RMTHelper.log("Waiting for the RM to have one free node");
while (this.resourceManager.getState().getFreeNodesNumber() != ONE_NODE_PER_HOST) {
Thread.sleep(ACTIVE_WAITING_PERIOD);
}
RMTHelper.log("The RM has one free node");
RMTHelper.log("Killing the free node");
String freeNodeUrl = this.resourceManager.getState().getFreeNodes().iterator().next();
RMTHelper.killRuntime(freeNodeUrl);
RMMonitorsHandler monitor = this.rmHelper.getMonitorsHandler();
monitor.flushEvents();
RMTHelper.log("Waiting for the RM to detect the node down");
RMNodeEvent nodeEvent = RMTHelper.waitForNodeEvent(RMEventType.NODE_STATE_CHANGED, freeNodeUrl, NODE_STATE_CHANGED_TIMEOUT, monitor);
assertEquals(NodeState.DOWN, nodeEvent.getNodeState());
}
Aggregations