Skip to content

Commit

Permalink
Add missing actuator metadata
Browse files Browse the repository at this point in the history
Health metadata for cassandra and couchbase is added.

See spring-projectsgh-7632
  • Loading branch information
eddumelendez authored and snicoll committed Dec 14, 2016
1 parent 2a5e22f commit fc09a23
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@
"type": "java.util.Map<java.lang.String,java.lang.Object>",
"description": "Arbitrary properties to add to the info endpoint."
},
{
"name": "management.health.cassandra.enabled",
"type": "java.lang.Boolean",
"description": "Enable cassandra health check.",
"defaultValue": true
},
{
"name": "management.health.couchbase.enabled",
"type": "java.lang.Boolean",
"description": "Enable couchbase health check.",
"defaultValue": true
},
{
"name": "management.health.db.enabled",
"type": "java.lang.Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,21 @@ public void cassandraHealthIndicator() throws Exception {
.isEqualTo(CassandraHealthIndicator.class);
}

@Test
public void notCassandraHealthIndicator() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"management.health.diskspace.enabled:false",
"management.health.cassandra.enabled:false");
this.context.register(CassandraConfiguration.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
this.context.refresh();
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertThat(beans).hasSize(1);
assertThat(beans.values().iterator().next().getClass())
.isEqualTo(ApplicationHealthIndicator.class);
}

@Test
public void couchbaseHealthIndicator() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
Expand All @@ -471,6 +486,21 @@ public void couchbaseHealthIndicator() throws Exception {
.isEqualTo(CouchbaseHealthIndicator.class);
}

@Test
public void notCouchbaseHealthIndicator() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context,
"management.health.diskspace.enabled:false",
"management.health.couchbase.enabled:false");
this.context.register(CouchbaseConfiguration.class,
ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
this.context.refresh();
Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class);
assertThat(beans.size()).isEqualTo(1);
assertThat(beans.values().iterator().next().getClass())
.isEqualTo(ApplicationHealthIndicator.class);
}

@Configuration
@EnableConfigurationProperties
protected static class DataSourceConfig {
Expand Down

0 comments on commit fc09a23

Please sign in to comment.