Search in sources :

Example 11 with RPCMessage

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());
}
Also used : SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage) NodesUnreachableException(com.sequenceiq.cloudbreak.util.NodesUnreachableException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 12 with RPCMessage

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());
}
Also used : SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) Node(com.sequenceiq.cloudbreak.common.orchestration.Node) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 13 with RPCMessage

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);
}
Also used : RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Example 14 with 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;
}
Also used : CheckResult(com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Example 15 with RPCMessage

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));
}
Also used : RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Aggregations

RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)18 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)8 CheckResult (com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult)4 Test (org.junit.jupiter.api.Test)4 NodeStatusReport (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatusReport)2 SaltHealthReport (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 NodeHealthDetails (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails)2 CheckEntry (com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry)2 PluginStatusEntry (com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry)2 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 NodesUnreachableException (com.sequenceiq.cloudbreak.util.NodesUnreachableException)1 Matcher (java.util.regex.Matcher)1