Search in sources :

Example 6 with HealthCheck

use of com.sequenceiq.cloudbreak.common.type.HealthCheck in project cloudbreak by hortonworks.

the class StackStatusCheckerJobTest method setupForCM.

private void setupForCM() {
    setStackStatus(DetailedStackStatus.AVAILABLE);
    when(clusterApi.clusterStatusService()).thenReturn(clusterStatusService);
    when(clusterStatusService.isClusterManagerRunningQuickCheck()).thenReturn(true);
    Set<HealthCheck> healthChecks = Sets.newHashSet(new HealthCheck(HealthCheckType.HOST, HealthCheckResult.HEALTHY, Optional.empty()), new HealthCheck(HealthCheckType.CERT, HealthCheckResult.UNHEALTHY, Optional.empty()));
    ExtendedHostStatuses extendedHostStatuses = new ExtendedHostStatuses(Map.of(HostName.hostName("host1"), healthChecks));
    when(clusterStatusService.getExtendedHostStatuses(any())).thenReturn(extendedHostStatuses);
    when(instanceMetaDataService.findNotTerminatedAndNotZombieForStack(anyLong())).thenReturn(Set.of(instanceMetaData));
    when(instanceMetaData.getInstanceStatus()).thenReturn(InstanceStatus.SERVICES_HEALTHY);
}
Also used : ExtendedHostStatuses(com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses) HealthCheck(com.sequenceiq.cloudbreak.common.type.HealthCheck)

Example 7 with HealthCheck

use of com.sequenceiq.cloudbreak.common.type.HealthCheck in project cloudbreak by hortonworks.

the class VmStatusCheckerConclusionStepTest method createExtendedHostStatuses.

private ExtendedHostStatuses createExtendedHostStatuses(boolean healthy) {
    Map<HostName, Set<HealthCheck>> hostStatuses = new HashMap<>();
    HealthCheckResult status = healthy ? HealthCheckResult.HEALTHY : HealthCheckResult.UNHEALTHY;
    String reason = healthy ? null : "error";
    Set<HealthCheck> healthChecks = Sets.newHashSet(new HealthCheck(HealthCheckType.HOST, status, Optional.ofNullable(reason)));
    hostStatuses.put(HostName.hostName("host1"), healthChecks);
    hostStatuses.put(HostName.hostName("host2"), healthChecks);
    return new ExtendedHostStatuses(hostStatuses);
}
Also used : ExtendedHostStatuses(com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses) Set(java.util.Set) HashMap(java.util.HashMap) HealthCheck(com.sequenceiq.cloudbreak.common.type.HealthCheck) HealthCheckResult(com.sequenceiq.cloudbreak.common.type.HealthCheckResult) HostName(com.sequenceiq.cloudbreak.cloud.model.HostName)

Aggregations

ExtendedHostStatuses (com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses)7 HealthCheck (com.sequenceiq.cloudbreak.common.type.HealthCheck)7 HostName (com.sequenceiq.cloudbreak.cloud.model.HostName)4 Set (java.util.Set)4 HashMap (java.util.HashMap)3 HostName.hostName (com.sequenceiq.cloudbreak.cloud.model.HostName.hostName)2 ClusterApi (com.sequenceiq.cloudbreak.cluster.api.ClusterApi)2 ClusterStatusService (com.sequenceiq.cloudbreak.cluster.api.ClusterStatusService)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 List (java.util.List)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 ClouderaManagerResourceApi (com.cloudera.api.swagger.ClouderaManagerResourceApi)1 ClustersResourceApi (com.cloudera.api.swagger.ClustersResourceApi)1 HostsResourceApi (com.cloudera.api.swagger.HostsResourceApi)1 RolesResourceApi (com.cloudera.api.swagger.RolesResourceApi)1