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");
}
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");
}
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());
}
Aggregations