Search in sources :

Example 6 with NODE_FAILURE

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.NODE_FAILURE in project cloudbreak by hortonworks.

the class UpdateNodeCountValidatorTest method validateStackStatusDownscaleNodeFailureTargetedUpscaleNotSupported.

@Test
void validateStackStatusDownscaleNodeFailureTargetedUpscaleNotSupported() throws Exception {
    when(targetedUpscaleSupportService.targetedUpscaleEntitlementsEnabled(any())).thenReturn(Boolean.FALSE);
    Stack stack = new Stack();
    stack.setName("stack");
    stack.setStackStatus(new StackStatus(stack, DetailedStackStatus.NODE_FAILURE));
    BadRequestException e = Assertions.assertThrows(BadRequestException.class, () -> underTest.validateStackStatus(stack, false));
    assertEquals("Data Hub 'stack' is currently in 'NODE_FAILURE' state. Node count can only be updated if it's running.", e.getMessage());
}
Also used : StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with NODE_FAILURE

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.NODE_FAILURE in project cloudbreak by hortonworks.

the class UpdateNodeCountValidatorTest method validateStackStatusUpscaleNodeFailureTargetedUpscaleNotSupported.

@Test
void validateStackStatusUpscaleNodeFailureTargetedUpscaleNotSupported() throws Exception {
    when(targetedUpscaleSupportService.targetedUpscaleEntitlementsEnabled(any())).thenReturn(Boolean.FALSE);
    Stack stack = new Stack();
    stack.setName("stack");
    stack.setStackStatus(new StackStatus(stack, DetailedStackStatus.NODE_FAILURE));
    BadRequestException e = Assertions.assertThrows(BadRequestException.class, () -> underTest.validateStackStatus(stack, true));
    assertEquals("Data Hub 'stack' is currently in 'NODE_FAILURE' state. Node count can only be updated if it's running.", e.getMessage());
}
Also used : StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)7 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)7 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)7 Test (org.junit.jupiter.api.Test)7 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)3 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)1 CertificatesRotationV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.CertificatesRotationV4Request)1