Search in sources :

Example 51 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class HostFenceActionExecutorTest method hostIsNotPoweredOffWhenFenceStatusReturnsOn.

/**
 * Test that host is not powered off when status action returns power on
 */
@Test
public void hostIsNotPoweredOffWhenFenceStatusReturnsOn() {
    mockFenceAgent();
    // result of fence action invoked on specified agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.SUCCESS, PowerStatus.ON));
    assertFalse(executor.isHostPoweredOff());
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 52 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class HostFenceActionExecutorTest method hostIsNotPoweredOffWhenFenceStatusFailed.

/**
 * Test that host is not powered off when status action returns error
 */
@Test
public void hostIsNotPoweredOffWhenFenceStatusFailed() {
    mockFenceAgent();
    // result of fence action invoked on specified agent
    mockFenceResult(agentExecutor1, new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN));
    assertFalse(executor.isHostPoweredOff());
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 53 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class SingleAgentFenceActionExecutorTest method failedGetStatus.

/**
 * Test failed status action
 */
@Test
public void failedGetStatus() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN);
    FenceOperationResult[] expectedResults = { expectedResult };
    mockFenceActionResults(expectedResults);
    FenceOperationResult result = executor.fence(FenceActionType.STATUS);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 54 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class SingleAgentFenceActionExecutorTest method failedStopWithStopRetry.

/**
 * Test failed stop action, when the 1st start attempt failed and retrying fence for stop is not allowed
 */
@Test
public void failedStopWithStopRetry() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN);
    FenceOperationResult[] expectedResults = { // result of the 1st stop action
    new FenceOperationResult(Status.ERROR, PowerStatus.UNKNOWN) };
    mockFenceActionResults(expectedResults);
    FenceOperationResult result = executor.fence(FenceActionType.STOP);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Example 55 with FenceOperationResult

use of org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult in project ovirt-engine by oVirt.

the class SingleAgentFenceActionExecutorTest method successfulStart.

/**
 * Test successful start action
 */
@Test
public void successfulStart() {
    FenceOperationResult expectedResult = new FenceOperationResult(Status.SUCCESS, PowerStatus.ON);
    FenceOperationResult[] expectedResults = { // result of start action
    new FenceOperationResult(Status.SUCCESS, PowerStatus.UNKNOWN), // result of 1st status action
    expectedResult };
    mockFenceActionResults(expectedResults);
    FenceOperationResult result = executor.fence(FenceActionType.START);
    validateResult(expectedResult, result);
}
Also used : FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) Test(org.junit.Test)

Aggregations

FenceOperationResult (org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult)58 Test (org.junit.Test)43 ArrayList (java.util.ArrayList)2 Action (org.ovirt.engine.api.model.Action)2 FenceAgent (org.ovirt.engine.core.common.businessentities.pm.FenceAgent)2 PowerStatus (org.ovirt.engine.core.common.businessentities.pm.PowerStatus)2 EngineException (org.ovirt.engine.core.common.errors.EngineException)2 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 Response (javax.ws.rs.core.Response)1 PowerManagement (org.ovirt.engine.api.model.PowerManagement)1 PowerManagementStatus (org.ovirt.engine.api.model.PowerManagementStatus)1 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)1 HostFenceActionExecutor (org.ovirt.engine.core.bll.pm.HostFenceActionExecutor)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1