Search in sources :

Example 1 with UpgradeCcmRemoveAgentRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest in project cloudbreak by hortonworks.

the class RemoveAgentHandlerTest method doAccept.

@Test
void doAccept() throws CloudbreakOrchestratorException {
    UpgradeCcmRemoveAgentRequest request = new UpgradeCcmRemoveAgentRequest(STACK_ID, CLUSTER_ID, Tunnel.CCM);
    when(event.getData()).thenReturn(request);
    Selectable result = underTest.doAccept(event);
    verify(upgradeCcmService).removeAgent(STACK_ID, Tunnel.CCM);
    assertThat(result.selector()).isEqualTo("UPGRADECCMREMOVEAGENTRESULT");
}
Also used : UpgradeCcmRemoveAgentRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) Test(org.junit.jupiter.api.Test)

Example 2 with UpgradeCcmRemoveAgentRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest in project cloudbreak by hortonworks.

the class RemoveAgentHandlerTest method orchestrationException.

@Test
void orchestrationException() throws CloudbreakOrchestratorException {
    UpgradeCcmRemoveAgentRequest request = new UpgradeCcmRemoveAgentRequest(STACK_ID, CLUSTER_ID, Tunnel.CCM);
    when(event.getData()).thenReturn(request);
    doThrow(new CloudbreakOrchestratorFailedException("salt error")).when(upgradeCcmService).removeAgent(any(), any());
    Selectable result = underTest.doAccept(event);
    verify(upgradeCcmService).removeAgent(STACK_ID, Tunnel.CCM);
    assertThat(result.selector()).isEqualTo("UPGRADECCMFAILEDEVENT");
}
Also used : UpgradeCcmRemoveAgentRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest) CloudbreakOrchestratorFailedException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) Test(org.junit.jupiter.api.Test)

Example 3 with UpgradeCcmRemoveAgentRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest in project cloudbreak by hortonworks.

the class RemoveAgentHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<UpgradeCcmRemoveAgentRequest> event) {
    UpgradeCcmRemoveAgentRequest request = event.getData();
    Long stackId = request.getResourceId();
    LOGGER.info("Remove agent for CCM upgrade...");
    try {
        upgradeCcmService.removeAgent(stackId, request.getOldTunnel());
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.debug("Failed removing agent with a salt state");
        return new UpgradeCcmFailedEvent(stackId, request.getOldTunnel(), e);
    }
    return new UpgradeCcmRemoveAgentResult(stackId, request.getClusterId(), request.getOldTunnel());
}
Also used : UpgradeCcmRemoveAgentRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest) CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UpgradeCcmFailedEvent(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent) UpgradeCcmRemoveAgentResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentResult)

Aggregations

UpgradeCcmRemoveAgentRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentRequest)3 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)2 Test (org.junit.jupiter.api.Test)2 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 CloudbreakOrchestratorFailedException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException)1 UpgradeCcmFailedEvent (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent)1 UpgradeCcmRemoveAgentResult (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmRemoveAgentResult)1