use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound.
@Test
public void checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound() throws NodesUnreachableException {
RPCResponse<SaltHealthReport> response = new RPCResponse<>();
RPCMessage message = new RPCMessage();
message.setMessage("rpc response");
response.setMessages(List.of(message));
when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
when(stackUtil.collectNodes(any())).thenReturn(Set.of(createNode("host1"), createNode("host2")));
when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenThrow(new NodesUnreachableException("error", Set.of("host1")));
Conclusion stepResult = underTest.check(1L);
assertTrue(stepResult.isFailureFound());
assertEquals("Unreachable nodes: [host1]. We detected that cluster members can’t communicate with each other. " + "Please validate if all cluster members are available and healthy through your cloud provider.", stepResult.getConclusion());
assertEquals("Unreachable salt minions: [host1]", stepResult.getDetails());
assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).saltPing(eq(1L));
verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
verify(stackUtil, times(1)).collectNodes(any());
verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound.
@Test
public void checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound() throws NodesUnreachableException {
RPCResponse<SaltHealthReport> response = new RPCResponse<>();
RPCMessage message = new RPCMessage();
message.setMessage("rpc response");
response.setMessages(List.of(message));
when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
Set<Node> nodes = Set.of(createNode("host1"), createNode("host2"));
when(stackUtil.collectNodes(any())).thenReturn(nodes);
when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenReturn(nodes);
Conclusion stepResult = underTest.check(1L);
assertFalse(stepResult.isFailureFound());
assertNull(stepResult.getConclusion());
assertNull(stepResult.getDetails());
assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).saltPing(eq(1L));
verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
verify(stackUtil, times(1)).collectNodes(any());
verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class FreeipaCheckerTest method createRpcMessage.
private List<RPCMessage> createRpcMessage() {
RPCMessage rpcMessage = new RPCMessage();
rpcMessage.setMessage("{'empty': 'json'}");
rpcMessage.setCode(SUCCESS_STATUS);
return List.of(rpcMessage);
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsServiceTest method getErrorPayload.
private RPCResponse<CheckResult> getErrorPayload(String host) {
CheckResult checkResult = new CheckResult();
checkResult.setHost(host);
RPCResponse<CheckResult> badResponse;
badResponse = new RPCResponse<>();
badResponse.setResult(checkResult);
RPCMessage message = new RPCMessage();
message.setCode(503);
message.setMessage("failure");
badResponse.setMessages(List.of(message));
return badResponse;
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class StackStatusTest method setUpFreeIpaAvailabilityResponse.
private void setUpFreeIpaAvailabilityResponse(boolean value) {
rpcResponse.setResult(value);
RPCMessage mess = new RPCMessage();
mess.setName("name");
mess.setMessage("message");
rpcResponse.setMessages(List.of(mess));
}
Aggregations