Search in sources :

Example 6 with RMMonitorsHandler

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());
}
Also used : StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) RMTHelper(functionaltests.utils.RMTHelper) SSHInfrastructureV2(org.ow2.proactive.resourcemanager.nodesource.infrastructure.SSHInfrastructureV2) File(java.io.File) RMNodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent) RMMonitorsHandler(functionaltests.monitor.RMMonitorsHandler) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Aggregations

RMMonitorsHandler (functionaltests.monitor.RMMonitorsHandler)6 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)3 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)3 Test (org.junit.Test)3 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)3 SSHInfrastructureV2 (org.ow2.proactive.resourcemanager.nodesource.infrastructure.SSHInfrastructureV2)3 RMTHelper (functionaltests.utils.RMTHelper)2 File (java.io.File)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 RestartDownNodesPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.RestartDownNodesPolicy)2 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Before (org.junit.Before)1 TestTimedOutException (org.junit.runners.model.TestTimedOutException)1 Node (org.objectweb.proactive.core.node.Node)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMState (org.ow2.proactive.resourcemanager.common.RMState)1 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)1 Criteria (org.ow2.proactive.utils.Criteria)1