Search in sources :

Example 1 with RMTHelper

use of functionaltests.utils.RMTHelper in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception {
    // restart RM
    this.rmHelper = new RMTHelper();
    this.startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(this.rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    // the node source has been recovered on restart: we should have one node source with the same name
    assertThat(nodeSourceEvent.size()).isEqualTo(1);
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    // wait for nodes to be recreated if needed
    if (nodesShouldBeRecreated) {
        this.rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, NODE_NUMBER);
    }
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 2 with RMTHelper

use of functionaltests.utils.RMTHelper in project scheduling by ow2-proactive.

the class TestRMProxy method setUp.

@BeforeClass
public static void setUp() throws Exception {
    if (TestScheduler.isStarted()) {
        SchedulerTHelper.log("Killing previous scheduler.");
        TestScheduler.kill();
    }
    rmHelper = new RMTHelper();
    rmHelper.getResourceManager();
    user1Credentials = Credentials.createCredentials(new CredData("admin", "admin"), rmHelper.getRMAuth().getPublicKey());
    user2Credentials = Credentials.createCredentials(new CredData("demo", "demo"), rmHelper.getRMAuth().getPublicKey());
    rmHelper.createNodeSource(nsName, NODES_NUMBER);
}
Also used : RMTHelper(functionaltests.utils.RMTHelper) CredData(org.ow2.proactive.authentication.crypto.CredData)

Example 3 with RMTHelper

use of functionaltests.utils.RMTHelper in project scheduling by ow2-proactive.

the class RecoverSSHInfrastructureV2Test method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception {
    // restart RM
    rmHelper = new RMTHelper();
    startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager;
    List<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    // the node source has been recovered on restart: we should have one node source with the same name
    assertThat(nodeSourceEvent.size()).isEqualTo(1);
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    // wait for nodes to be recreated if needed
    if (nodesShouldBeRecreated) {
        rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, TestSSHInfrastructureV2.NB_NODES);
    }
    // the nodes should have been recovered too, and should be alive
    Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes();
    assertThat(allNodes.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES);
    Set<String> nodeSourceNames = new HashSet<>();
    nodeSourceNames.add(NODE_SOURCE_NAME);
    Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames);
    assertThat(aliveNodeUrls.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES);
    // the recovered nodes should be usable, try to lock/unlock them to see
    BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes);
    assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true));
    BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes);
    assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true));
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet)

Example 4 with RMTHelper

use of functionaltests.utils.RMTHelper in project scheduling by ow2-proactive.

the class RecoverDefaultInfrastructureTest method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState() throws Exception {
    // restart RM
    this.rmHelper = new RMTHelper();
    this.startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(this.rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    // the node source has been recovered on restart: we should have one node source with the same name
    assertThat(nodeSourceEvent.size()).isEqualTo(1);
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    assertThat(nodeSourceEvent.get(0).getNodeSourceDescription().contains(NODE_SOURCE_USER_ACCESS_TYPE));
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 5 with RMTHelper

use of functionaltests.utils.RMTHelper in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState() throws Exception {
    // restart RM
    this.rmHelper = new RMTHelper();
    this.startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(this.rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    // the node source has been recovered on restart: we should have one node source with the same name
    assertThat(nodeSourceEvent.size()).isEqualTo(1);
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    assertThat(nodeSourceEvent.get(0).getNodeSourceDescription().contains(NODE_SOURCE_USER_ACCESS_TYPE));
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Aggregations

RMTHelper (functionaltests.utils.RMTHelper)7 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)6 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)6 HashSet (java.util.HashSet)3 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 TestSSHInfrastructureV2 (functionaltests.nodesource.TestSSHInfrastructureV2)1 NODES_RECOVERABLE (functionaltests.nodesrecovery.RecoverInfrastructureTestHelper.NODES_RECOVERABLE)1 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)1 File (java.io.File)1 List (java.util.List)1 Set (java.util.Set)1 After (org.junit.After)1 Before (org.junit.Before)1 Test (org.junit.Test)1 CredData (org.ow2.proactive.authentication.crypto.CredData)1 NodeState (org.ow2.proactive.resourcemanager.common.NodeState)1 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)1 PAResourceManagerProperties (org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties)1 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)1