Search in sources :

Example 1 with UpgradeCcmReconfigureNginxRequest

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

the class ReconfigureNginxHandlerTest method orchestrationException.

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

Example 2 with UpgradeCcmReconfigureNginxRequest

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

the class ReconfigureNginxHandlerTest method doAccept.

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

Example 3 with UpgradeCcmReconfigureNginxRequest

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

the class ReconfigureNginxHandler method doAccept.

@Override
public Selectable doAccept(HandlerEvent<UpgradeCcmReconfigureNginxRequest> event) {
    UpgradeCcmReconfigureNginxRequest request = event.getData();
    Long stackId = request.getResourceId();
    LOGGER.info("NGINX reconfiguration is needed for previous CCM tunnel type");
    try {
        upgradeCcmService.reconfigureNginx(stackId);
    } catch (CloudbreakOrchestratorException e) {
        LOGGER.debug("Failed reconfiguring NGINX with salt state");
        return new UpgradeCcmFailedEvent(stackId, request.getOldTunnel(), e);
    }
    return new UpgradeCcmReconfigureNginxResult(stackId, request.getClusterId(), request.getOldTunnel());
}
Also used : CloudbreakOrchestratorException(com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException) UpgradeCcmReconfigureNginxRequest(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxRequest) UpgradeCcmFailedEvent(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmFailedEvent) UpgradeCcmReconfigureNginxResult(com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxResult)

Aggregations

UpgradeCcmReconfigureNginxRequest (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxRequest)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 UpgradeCcmReconfigureNginxResult (com.sequenceiq.cloudbreak.reactor.api.event.cluster.upgrade.ccm.UpgradeCcmReconfigureNginxResult)1