Search in sources :

Example 6 with ApiHealthCheck

use of com.cloudera.api.swagger.model.ApiHealthCheck 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")));
}
Also used : ExtendedHostStatuses(com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses) ApiHealthCheck(com.cloudera.api.swagger.model.ApiHealthCheck) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 7 with ApiHealthCheck

use of com.cloudera.api.swagger.model.ApiHealthCheck 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")));
}
Also used : ApiHealthCheck(com.cloudera.api.swagger.model.ApiHealthCheck) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 8 with ApiHealthCheck

use of com.cloudera.api.swagger.model.ApiHealthCheck 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());
}
Also used : ExtendedHostStatuses(com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses) ApiHealthCheck(com.cloudera.api.swagger.model.ApiHealthCheck) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Aggregations

ApiHealthCheck (com.cloudera.api.swagger.model.ApiHealthCheck)8 ApiHost (com.cloudera.api.swagger.model.ApiHost)8 Test (org.junit.Test)7 ExtendedHostStatuses (com.sequenceiq.cloudbreak.cluster.status.ExtendedHostStatuses)6 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 ServicesResourceApi (com.cloudera.api.swagger.ServicesResourceApi)1 ApiClient (com.cloudera.api.swagger.client.ApiClient)1 ApiException (com.cloudera.api.swagger.client.ApiException)1 ApiCommand (com.cloudera.api.swagger.model.ApiCommand)1 ApiHealthSummary (com.cloudera.api.swagger.model.ApiHealthSummary)1 ApiHostList (com.cloudera.api.swagger.model.ApiHostList)1 ApiRole (com.cloudera.api.swagger.model.ApiRole)1 ApiRoleRef (com.cloudera.api.swagger.model.ApiRoleRef)1 ApiRoleState (com.cloudera.api.swagger.model.ApiRoleState)1 ApiService (com.cloudera.api.swagger.model.ApiService)1 ApiServiceState (com.cloudera.api.swagger.model.ApiServiceState)1 ApiVersionInfo (com.cloudera.api.swagger.model.ApiVersionInfo)1