use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionStatusSaltResponse in project cloudbreak by hortonworks.
the class SaltOrchestratorTest method tearDownTest.
@Test
public void tearDownTest() throws Exception {
Map<String, String> privateIpsByFQDN = new HashMap<>();
privateIpsByFQDN.put("10-0-0-1.example.com", "10.0.0.1");
privateIpsByFQDN.put("10-0-0-2.example.com", "10.0.0.2");
privateIpsByFQDN.put("10-0-0-3.example.com", "10.0.0.3");
Set<String> privateIps = privateIpsByFQDN.values().stream().collect(Collectors.toSet());
mockStatic(SaltStates.class);
SaltStates.stopMinions(eq(saltConnector), eq(privateIps));
MinionStatusSaltResponse minionStatusSaltResponse = new MinionStatusSaltResponse();
List<MinionStatus> minionStatusList = new ArrayList<>();
MinionStatus minionStatus = new MinionStatus();
List<String> upNodes = Lists.newArrayList("10-0-0-1.example.com", "10-0-0-2.example.com", "10-0-0-3.example.com");
minionStatus.setUp(upNodes);
List<String> downNodes = Lists.newArrayList("10-0-0-4.example.com", "10-0-0-5.example.com");
minionStatus.setDown(downNodes);
minionStatusList.add(minionStatus);
minionStatusSaltResponse.setResult(minionStatusList);
when(SaltStates.collectNodeStatus(eq(saltConnector))).thenReturn(minionStatusSaltResponse);
saltOrchestrator.tearDown(null, Collections.singletonList(gatewayConfig), privateIpsByFQDN, Set.of(), null);
verify(saltConnector, never()).wheel(eq("key.delete"), eq(downNodes), eq(Object.class));
verifyStatic(SaltStates.class);
SaltStates.stopMinions(eq(saltConnector), eq(privateIps));
}
use of com.sequenceiq.cloudbreak.orchestrator.salt.domain.MinionStatusSaltResponse in project cloudbreak by hortonworks.
the class ManageStatusSaltResponse method run.
@Override
public Object run(String mockUuid, Map<String, List<String>> params) throws Exception {
MinionStatusSaltResponse minionStatusSaltResponse = new MinionStatusSaltResponse();
List<MinionStatus> minionStatusList = new ArrayList<>();
MinionStatus minionStatus = new MinionStatus();
ArrayList<String> upList = new ArrayList<>();
minionStatus.setUp(upList);
ArrayList<String> downList = new ArrayList<>();
minionStatus.setDown(downList);
minionStatusList.add(minionStatus);
minionStatusSaltResponse.setResult(minionStatusList);
for (CloudVmMetaDataStatus cloudVmMetaDataStatus : spiStoreService.getMetadata(mockUuid)) {
if (InstanceStatus.STARTED == cloudVmMetaDataStatus.getCloudVmInstanceStatus().getStatus()) {
String privateIp = cloudVmMetaDataStatus.getMetaData().getPrivateIp();
upList.add(hostNameService.getHostName(mockUuid, privateIp));
}
}
return minionStatusSaltResponse;
}
Aggregations