use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class BaseClouderaManagerCommDecommTest method createApiHostRef.
protected ApiHost createApiHostRef(String instanceFqd, ApiHealthSummary healthSummary) {
ApiHost instanceHostRef = new ApiHost();
instanceHostRef.setHostname(instanceFqd);
instanceHostRef.setHostId(instanceFqd);
instanceHostRef.setHealthSummary(healthSummary);
return instanceHostRef;
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class BaseClouderaManagerCommDecommTest method createGoodHealthApiHostList.
protected ApiHostList createGoodHealthApiHostList(Set<String> hostnames) {
List<ApiHost> apiHosts = hostnames.stream().map(h -> createGoodHealthApiHostRef(h)).collect(Collectors.toList());
ApiHostList apiHostList = new ApiHostList();
apiHostList.setItems(apiHosts);
return apiHostList;
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method getDecommissionedHostsFromCM.
@Test
public void getDecommissionedHostsFromCM() throws ApiException {
hostsAre(new ApiHost().hostname("host1").maintenanceMode(true), new ApiHost().hostname("host2").maintenanceMode(false));
List<String> hosts = subject.getDecommissionedHostsFromCM();
assertEquals(1, hosts.size());
assertEquals("host1", hosts.get(0));
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method testServiceBadHealth.
@Test
public void testServiceBadHealth() throws ApiException {
hostsAre(new ApiHost().hostname("host1").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.BAD).explanation("explanation")).addHealthChecksItem(new ApiHealthCheck().name(HOST_AGENT_CERTIFICATE_EXPIRY).summary(ApiHealthSummary.GOOD)).addRoleRefsItem(roleRef("badservice", ApiHealthSummary.BAD)), new ApiHost().hostname("host2").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)).addHealthChecksItem(new ApiHealthCheck().name(HOST_AGENT_CERTIFICATE_EXPIRY).summary(ApiHealthSummary.GOOD).explanation("in 30 days")).addRoleRefsItem(roleRef("badservice2", ApiHealthSummary.BAD)).addRoleRefsItem(roleRef("badservice3", ApiHealthSummary.BAD)));
ExtendedHostStatuses extendedHostStatuses = subject.getExtendedHostStatuses(Optional.of("7.2.12"));
assertFalse(extendedHostStatuses.isAnyCertExpiring());
assertFalse(extendedHostStatuses.isHostHealthy(hostName("host1")));
assertFalse(extendedHostStatuses.isHostHealthy(hostName("host2")));
assertEquals("explanation. The following services are in bad health: badservice.", extendedHostStatuses.statusReasonForHost(hostName("host1")));
assertEquals("The following services are in bad health: badservice2, badservice3.", extendedHostStatuses.statusReasonForHost(hostName("host2")));
extendedHostStatuses = subject.getExtendedHostStatuses(Optional.of("7.2.11"));
assertFalse(extendedHostStatuses.isAnyCertExpiring());
assertFalse(extendedHostStatuses.isHostHealthy(hostName("host1")));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host2")));
assertEquals("explanation.", extendedHostStatuses.statusReasonForHost(hostName("host1")));
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method collectsHostHealthIfAvailable.
@Test
public void collectsHostHealthIfAvailable() throws ApiException {
hostsAre(new ApiHost().hostname("host1").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)), new ApiHost().hostname("host2").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.CONCERNING)), new ApiHost().hostname("host3").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.BAD)), new ApiHost().hostname("host4").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.NOT_AVAILABLE)), new ApiHost().hostname("host5").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.HISTORY_NOT_AVAILABLE)), new ApiHost().hostname("host6").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.DISABLED)));
ExtendedHostStatuses extendedHostStatuses = subject.getExtendedHostStatuses(Optional.of("7.2.12"));
assertFalse(extendedHostStatuses.isHostHealthy(hostName("host3")));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host1")));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host2")));
}
Aggregations