use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner in project cloudbreak by hortonworks.
the class SaltTelemetryOrchestratorTest method testExecuteDiagnosticCollection.
@Test
void testExecuteDiagnosticCollection() throws Exception {
Map<String, Object> parameters = getParametersMap();
underTest.executeDiagnosticCollection(gatewayConfigs, targets, parameters, exitCriteriaModel);
SaltJobIdTracker saltJobIdTracker = (SaltJobIdTracker) orchestratorBootstrapArgumentCaptor.getValue();
ConcurrentParameterizedStateRunner saltJobRunner = (ConcurrentParameterizedStateRunner) saltJobIdTracker.getSaltJobRunner();
Assertions.assertTrue(CollectionUtils.isEqualCollection(targets, saltJobRunner.getAllNode()));
assertEquals(SaltTelemetryOrchestrator.FILECOLLECTOR_COLLECT, saltJobRunner.getState());
verify(callable, Mockito.times(1)).call();
verify(saltService, Mockito.times(1)).getPrimaryGatewayConfig(gatewayConfigs);
verify(saltRunner, Mockito.times(1)).runner(any(), any(), any(), anyInt(), anyBoolean());
verify(telemetrySaltRetryConfig, Mockito.times(1)).getDiagnosticsCollect();
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner in project cloudbreak by hortonworks.
the class SaltTelemetryOrchestratorTest method testUploadCollectedDiagnostics.
@Test
void testUploadCollectedDiagnostics() throws Exception {
Map<String, Object> parameters = getParametersMap();
underTest.uploadCollectedDiagnostics(gatewayConfigs, targets, parameters, exitCriteriaModel);
SaltJobIdTracker saltJobIdTracker = (SaltJobIdTracker) orchestratorBootstrapArgumentCaptor.getValue();
ConcurrentParameterizedStateRunner saltJobRunner = (ConcurrentParameterizedStateRunner) saltJobIdTracker.getSaltJobRunner();
Assertions.assertTrue(CollectionUtils.isEqualCollection(targets, saltJobRunner.getAllNode()));
assertEquals(SaltTelemetryOrchestrator.FILECOLLECTOR_UPLOAD, saltJobRunner.getState());
verify(callable, Mockito.times(1)).call();
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner in project cloudbreak by hortonworks.
the class SaltTelemetryOrchestratorTest method testCleanupCollectedDiagnostics.
@Test
void testCleanupCollectedDiagnostics() throws Exception {
Map<String, Object> parameters = getParametersMap();
underTest.cleanupCollectedDiagnostics(gatewayConfigs, targets, parameters, exitCriteriaModel);
SaltJobIdTracker saltJobIdTracker = (SaltJobIdTracker) orchestratorBootstrapArgumentCaptor.getValue();
ConcurrentParameterizedStateRunner saltJobRunner = (ConcurrentParameterizedStateRunner) saltJobIdTracker.getSaltJobRunner();
Assertions.assertTrue(CollectionUtils.isEqualCollection(targets, saltJobRunner.getAllNode()));
assertEquals(SaltTelemetryOrchestrator.FILECOLLECTOR_CLEANUP, saltJobRunner.getState());
verify(callable, Mockito.times(1)).call();
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner in project cloudbreak by hortonworks.
the class SaltTelemetryOrchestratorTest method testInitDiagnosticCollection.
@Test
void testInitDiagnosticCollection() throws Exception {
Map<String, Object> parameters = getParametersMap();
underTest.initDiagnosticCollection(gatewayConfigs, targets, parameters, exitCriteriaModel);
SaltJobIdTracker saltJobIdTracker = (SaltJobIdTracker) orchestratorBootstrapArgumentCaptor.getValue();
ConcurrentParameterizedStateRunner saltJobRunner = (ConcurrentParameterizedStateRunner) saltJobIdTracker.getSaltJobRunner();
Assertions.assertTrue(CollectionUtils.isEqualCollection(targets, saltJobRunner.getAllNode()));
assertEquals(SaltTelemetryOrchestrator.FILECOLLECTOR_INIT, saltJobRunner.getState());
verify(callable, Mockito.times(1)).call();
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.poller.checker.ConcurrentParameterizedStateRunner in project cloudbreak by hortonworks.
the class SaltTelemetryOrchestrator method runSaltState.
// CHECKSTYLE:OFF
private void runSaltState(List<GatewayConfig> allGateways, Set<Node> nodes, Map<String, Object> parameters, ExitCriteriaModel exitModel, String saltState, String errorMessage, int retryCount, boolean retryOnFail) throws CloudbreakOrchestratorFailedException {
// CHECKSTYLE:ON
GatewayConfig primaryGateway = saltService.getPrimaryGatewayConfig(allGateways);
Set<String> targetHostnames = nodes.stream().map(Node::getHostname).collect(Collectors.toSet());
try (SaltConnector sc = saltService.createSaltConnector(primaryGateway)) {
ConcurrentParameterizedStateRunner stateRunner = new ConcurrentParameterizedStateRunner(targetHostnames, nodes, saltState, parameters);
OrchestratorBootstrap saltJobIdTracker = new SaltJobIdTracker(sc, stateRunner, retryOnFail);
Callable<Boolean> saltJobRunBootstrapRunner = saltRunner.runner(saltJobIdTracker, exitCriteria, exitModel, retryCount, false);
saltJobRunBootstrapRunner.call();
} catch (Exception e) {
LOGGER.debug(errorMessage, e);
throw new CloudbreakOrchestratorFailedException(e);
}
}
Aggregations