use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method testEverythingGood.
@Test
public void testEverythingGood() throws ApiException {
hostsAre(new ApiHost().hostname("host1").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)).addHealthChecksItem(new ApiHealthCheck().name(HOST_AGENT_CERTIFICATE_EXPIRY).summary(ApiHealthSummary.GOOD)), 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")));
ExtendedHostStatuses extendedHostStatuses = subject.getExtendedHostStatuses(Optional.of("7.2.12"));
assertFalse(extendedHostStatuses.isAnyCertExpiring());
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host1")));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host2")));
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method hostWithoutAppropriateHealthCheckIsIgnored.
@Test
public void hostWithoutAppropriateHealthCheckIsIgnored() throws ApiException {
hostsAre(new ApiHost().hostname("hostY").addHealthChecksItem(new ApiHealthCheck().name("fake_check").summary(ApiHealthSummary.BAD)));
assertFalse(subject.getExtendedHostStatuses(Optional.of("7.2.12")).getHostsHealth().containsKey(hostName("hostY")));
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerClusterStatusServiceTest method testCertExpiringEverythingElseGood.
@Test
public void testCertExpiringEverythingElseGood() throws ApiException {
hostsAre(new ApiHost().hostname("host1").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)).addHealthChecksItem(new ApiHealthCheck().name(HOST_AGENT_CERTIFICATE_EXPIRY).summary(ApiHealthSummary.GOOD)), new ApiHost().hostname("host2").addHealthChecksItem(new ApiHealthCheck().name(HOST_SCM_HEALTH).summary(ApiHealthSummary.GOOD)).addHealthChecksItem(new ApiHealthCheck().name(HOST_AGENT_CERTIFICATE_EXPIRY).summary(ApiHealthSummary.CONCERNING).explanation("in 30 days")));
ExtendedHostStatuses extendedHostStatuses = subject.getExtendedHostStatuses(Optional.of("7.2.12"));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host1")));
assertTrue(extendedHostStatuses.isHostHealthy(hostName("host2")));
assertTrue(extendedHostStatuses.isAnyCertExpiring());
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerHostStatusCheckerTest method shouldBeFalseWhenHostsReturnedHasOldHeartbeat.
@Test
public void shouldBeFalseWhenHostsReturnedHasOldHeartbeat() throws ApiException {
InstanceMetaData instanceMetaData = validInstanceMetadata();
ApiHost apiHost = new ApiHost().ipAddress(instanceMetaData.getPrivateIp()).lastHeartbeat(Instant.now().minus(5, ChronoUnit.MINUTES).toString());
when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData));
assertFalse(result);
}
use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.
the class ClouderaManagerHostStatusCheckerTest method shouldBeTrueWhenMultipleValidHosts.
@Test
public void shouldBeTrueWhenMultipleValidHosts() throws ApiException {
InstanceMetaData instanceMetaData = validInstanceMetadata();
InstanceMetaData instanceMetaData2 = validInstanceMetadata();
instanceMetaData2.setPrivateIp("2.2.2.2");
ApiHost apiHost = getValidApiHost(instanceMetaData);
ApiHost apiHost2 = getValidApiHost(instanceMetaData2);
when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost, apiHost2)));
boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData, instanceMetaData2));
assertTrue(result);
}
Aggregations